<p>Just wanted to point out that SMOTE generally doesn't improve prediction quality. See <a href="https://arxiv.org/abs/2201.08528" rel="nofollow noreferrer">https://arxiv.org/abs/2201.08528</a></p>
oversampling (SMOTE) does not work properly when fitted inside a pipeline
<p>I have an imbalanced classification problem and I am using <code>make_pipeline</code> from <code>imblearn</code></p>
<p>So the steps are the following:</p>
<pre><code>kf = StratifiedKFold(n_splits=10, random_state=42, shuffle=True)
params = {
    'max_depth': [2,3,5],
#     'max_features':['auto', 'sqrt', 'log2'],
#     'min_samples_leaf': [5,10,20,50,100,200,300],
    'n_estimators': [10,25,30,50]
#     'bootstrap': [True, False]

}
from imblearn.pipeline import make_pipeline
imba_pipeline = make_pipeline(SMOTE(random_state = 42), RobustScaler(), RandomForestClassifier(random_state=42)) 
imba_pipeline

out:Pipeline(steps=[('smote', SMOTE(random_state=42)),
                ('robustscaler', RobustScaler()),
                ('randomforestclassifier',
                 RandomForestClassifier(random_state=42))])

new_params = {'randomforestclassifier__' + key: params[key] for key in params}
grid_imba = GridSearchCV(imba_pipeline, param_grid=new_params, cv=kf, scoring='recall',
                        return_train_score=True, n_jobs=-1, verbose=2)

grid_imba.fit(X_train, y_train)
</code></pre>
<p>And everything is going ok and I am reaching to the end to by problem (i.e I can see the classification report)</p>
<p>However when I am trying to see inside the black box with <code>eli5</code> with <code>eli.explain_weights(imba_pipeline)</code></p>
<p>I get back as error</p>
<pre><code>TypeError: All intermediate steps should be transformers and implement fit and transform or be the string 'passthrough' 'SMOTE(random_state=42)' (type &lt;class 'imblearn.over_sampling._smote.SMOTE'&gt;) doesn't
</code></pre>
<p>I know that this Is a common problem and i have read the related questions but i am confused as the problem  is occurred after the end of my classification procedure</p>
<p>Any suggestions?</p>