Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Last active October 19, 2021 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liannewriting/0b97c80cfe3b5cec002ac178f57835cf to your computer and use it in GitHub Desktop.
Save liannewriting/0b97c80cfe3b5cec002ac178f57835cf to your computer and use it in GitHub Desktop.
python imbalanced data machine learning classification
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression(random_state=888)
clf.fit(df_train_oversample[features], df_train_oversample['Class'])
y_pred = clf.predict_proba(df_test[features])[:, 1]
from sklearn.metrics import roc_auc_score
roc_auc_score(df_test['Class'], y_pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment