如何在下面的imblearn.pipeline
管道中加入SimpleImputer(strategy='constant',fill_value= 0))
和("scale", MaxAbsScaler())
?我没有看到在imblearn.pipeline
管道框架中加入数据预处理步骤的任何选项。非常感谢您的建议!
smote_pipe = make_imb_pipeline(SMOTE(), LogisticRegression())scores = cross_validate(smote_pipe, X_train, y_train, cv=10, scoring=('roc_auc', 'average_precision'))pd.DataFrame(scores)[['test_roc_auc', 'test_average_precision']].mean()
回答:
这些可能没有在文档中提及,但您可以加入它们。
这是一个相当简约的可复现示例:
输出(大概的,由于有一定的随机性):
0.83750.7485714285714286