【发布时间】:2022-01-17 17:20:31
【问题描述】:
我想使用 sklearn 的管道执行一些像这张图这样的预处理。
如果我放弃标准化步骤,我可以毫无问题地做到这一点。但我不明白如何表明插补步骤的输出应该流向标准化步骤。
这是没有标准化步骤的当前代码:
preprocessor = ColumnTransformer(
transformers=[
("numeric_imputation", NumericImputation(), dq.numeric_variables),
("onehot", OneHotEncoder(handle_unknown="ignore"), dq.categorical_variables),
],
remainder="passthrough",
)
bp2 = make_pipeline(
preprocessor, ElasticNet()
)
【问题讨论】:
标签: python scikit-learn