How does imblearn apply the transformations during prediction? Let's say I have a sklearn pipeline that:


Imputes the data
Randomly oversamples the minority class


from imblearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from imblearn.over_sampling import RandomOverSampler

pipeline = Pipeline(
    [('1', SimpleImputer(strategy='median'),
     ('2', RandomOverSampler(random_state=0)),
     ('estimator', &lt;Some Logistic Regression&gt;)
    ]
)


I can then fit this to my training set pipeline.fit(X_train, y_train) and the random oversampler should properly identify the class to sample. What if I try to predict i.e pipeline.predict(X_test)? Since there are no classes, does the random oversampler still apply? I would expect the imputer to apply regardless but what about RandomOverSampler?

Thank you
You generally shouldn't apply resampling to the test set (although there are some differing opinions on whether to do so on various levels of validation data).  imblearn has its own version of the pipeline to accomplish this; in particular, the pipeline docs say:


  The samplers are only applied during fit.