Skip to content

Instantly share code, notes, and snippets.

@terrah27
Created February 3, 2019 21:22
Show Gist options
  • Save terrah27/17233d8aa28c97b0b3be8d641c6eda4a to your computer and use it in GitHub Desktop.
Save terrah27/17233d8aa28c97b0b3be8d641c6eda4a to your computer and use it in GitHub Desktop.
from imblearn.over_sampling import SMOTE
# Separate input features and target
y = df.Class
X = df.drop('Class', axis=1)
# setting up testing and training sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=27)
sm = SMOTE(random_state=27, ratio=1.0)
X_train, y_train = sm.fit_sample(X_train, y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment