text_plain_output_1.png
from imblearn.over_sampling import SMOTE

from imblearn.under_sampling import NearMiss

from sklearn.linear_model import LogisticRegression

from sklearn.metrics import confusion_matrix,classification_report

y_train.value_counts()

from imblearn.over_sampling import SMOTE
sm = SMOTE(random_state=2)
X_train_res, y_train_res = sm.fit_resample(X_train, y_train.ravel())

from imblearn.under_sampling import NearMiss
nr = NearMiss()
X_train_miss, y_train_miss = nr.fit_resample(X_train, y_train.ravel())

lr2 = LogisticRegression()
lr2.fit(X_train_miss, y_train_miss.ravel())
predictions2 = lr2.predict(X_valid)

confusion_matrix(y_valid, predictions2)