Skip to content

Instantly share code, notes, and snippets.

@tiaplagata
Created November 17, 2020 02:48
Show Gist options
  • Save tiaplagata/7fef4273e4f515c630d8092cdb0f3198 to your computer and use it in GitHub Desktop.
Save tiaplagata/7fef4273e4f515c630d8092cdb0f3198 to your computer and use it in GitHub Desktop.
Using Smote in a Pipeline
from imblearn.pipeline import Pipeline
from imblearn.over_sampling import SMOTE
from sklearn.ensemble import GradientBoostingClassifier
pipeline = Pipeline(steps= [
("SMOTE", SMOTE()),
("GradientBooster", GradientBoostingClassifier())
])
pipeline.fit(X_train, y_train)
y_test_preds = pipeline.predict(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment