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/cf8be8f11b8e9136e6c795ececd8753c to your computer and use it in GitHub Desktop.
Save liannewriting/cf8be8f11b8e9136e6c795ececd8753c to your computer and use it in GitHub Desktop.
python imbalanced data machine learning classification
from sklearn.model_selection import train_test_split
df_train, df_test = train_test_split(df, test_size=0.2, stratify=df['Class'], random_state=888)
features = df_train.drop(columns=['Class']).columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment