I\'m relatively new to Python. Can you help me improve my implementation of SMOTE to a proper pipeline? What I want is to apply the over and under sampling on the training set o
This looks like it would fit the bill http://contrib.scikit-learn.org/imbalanced-learn/stable/generated/imblearn.over_sampling.SMOTE.html
You'll want to create your own transformer
(http://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html) that upon calling fit
returns a balanced data set (presumably the one gotten from StratifiedKFold
), but upon calling predict
, which is that is going to happen for the test data, calls into SMOTE.