BalancedBaggingClassifier(that use a
RandomUnderSamplerwith a strong learner as a
TypeError: All intermediate steps of the chain should be estimators that implement fit and transform or fit_resample. 'Pipeline(steps=[('smote', SMOTE(n_jobs=-1, random_state=42)), ('under', RandomUnderSampler(random_state=42))])' implements both)Also, can someone explain what this error means? The Pipeline only exposes fit and fit_resample methods, since, transform is not being implemented, the first condition is not met and the second one about fit_resample is being met. Then, shouldn't this work? Thank you.
Main_Pipeline = imb_Pipeline([ ('feature_handler', FeatureTransformer(list(pearson_feature_vector.index))), ('smote', SMOTE()), ('random_under_sampler', RandomUnderSampler()), ('scaler', StandardScaler()), ('pca', PCA(n_components=0.99)), ('model', LogisticRegression(max_iter=1750)), ])
Please correct me if my understanding is lacking.
So, when I call
fit to the
Main_Pipeline , since
smote_pipeline as a fit present, it is assumed that
transform is also present, actually it doesn't, I tried to call
transform and got an error:
AttributeError: 'RandomUnderSampler' object has no attribute 'transform'
Smote_Under_pipeline = imb_Pipeline([ ('smote', SMOTE(random_state=rnd_state, n_jobs=-1)), ('under', RandomUnderSampler(random_state=rnd_state)), ]
, and accordingly because of assumption
fit_resample both become available. This causes ambuiguity and the code blows up?