from imblearn.pipeline import Pipeline
from imblearn.over_sampling import SMOTE
smt = SMOTE(random_state=0)
pipeline_rf_smt_fs = Pipeline(
[
('preprocess',preprocessor),
('selector', SelectKBest(mutual_info_classif, k=30)),
('smote',smt),
('rf_classifier',RandomForestClassifier(n_estimators=600, random_state =2021))
]
)
我遇到以下错误:所有中间步骤都应该是转换器并实现拟合和转换,或者是字符串 'passthrough' 'SMOTE(random_state=0)' (type <class 'imblearn.over_sampling._smote.SMOTE'>) 不
我相信 smote 必须使用后期特征选择过程。对此的任何帮助都会非常有帮助。