Skip to content
Advertisement

Pipline with SMOTE and Imputer Errors

i am trying to create a pipeline that first impute missing data , do oversampling with the SMOTE and the the model

my code worked perfectly before i try smote not i cant find any solution

here is the code without smote

JavaScript

And here’s the code after adding smote Note: I tired importing make pipeline from imlearn

JavaScript

when i import Pipeline From SKLearn i got this error

All intermediate steps should be transformers and implement fit and transform or be the string ‘passthrough’ ‘SMOTE()’ (type <class ‘imblearn.over_sampling._smote.base.SMOTE’>) doesn’t

when i tried importing makepipeline from imlearn i get this error

Last step of Pipeline should implement fit or be the string ‘passthrough’. ‘[(‘i’, SimpleImputer(strategy=’most_frequent’)), (‘over’, SMOTE()), (‘m’, RandomForestClassifier())]’ (type <class ‘list’>) doesn’t

Advertisement

Answer

Use the imblearn pipline:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement