Skip to content

Instantly share code, notes, and snippets.

@finnqiao
Created January 8, 2019 17:13
Show Gist options
  • Save finnqiao/ac201b6003bad09135048c21184348a5 to your computer and use it in GitHub Desktop.
Save finnqiao/ac201b6003bad09135048c21184348a5 to your computer and use it in GitHub Desktop.
from imblearn.over_sampling import SMOTE
X_train, X_test, y_train, y_test = train_test_split(X_df_2, y, test_size = 0.2, random_state = 10)
sm = SMOTE(random_state = 2)
X_train_res, y_train_res = sm.fit_sample(X_train, y_train.ravel())
clf = LogisticRegression()
model_res = clf.fit(X_train_res, y_train_res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment