【发布时间】:2021-06-13 23:59:31
【问题描述】:
我正在使用 imblearn 的 make_pipeline 函数来进行一些数据准备和建模。现在我想在我的模型上使用 feature_importance_ 方法。但由于我的模型是我管道的一部分,我不能使用这种方法。所以我想参考我管道中的模型。因此,我稍微修改了我的管道代码,为我的管道步骤指定了特定名称。但这不起作用。
我的代码:
my_pipeline = make_pipeline([( make_column_transformer(
(make_pipeline(
MinMaxScaler()
), ['column_a','column_b']),
remainder="passthrough")),
(PCA()),
(SMOTE()),
("classifier",RandomForestClassifier())])
【问题讨论】:
标签: python scikit-learn pipeline imblearn