我正在阅读Scikit Learn的Pipeline部分,来自“使用Scikit Learn和Tensorflow进行实际操作的机器学习”。本书对管道的解释如下
When you call the pipeline’s fit() method, it calls fit_transform() sequentially on all transformers, passing the output of each call as the parameter to the next call, until it reaches the final estimator, for which it just calls the fit() method
我试图从文本中推断管道在Python中是如何工作的。在
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
num_pipeline = Pipeline([
('imputer', Imputer(strategy="median")),
('std_scaler', StandardScaler()),
])
result = num_pipeline.fit(data)
result
一开始,我以为这就是Python内部的情况:
Imputer(strategy="median")
的实例,它是imputer
imputer.fit_transform(data)
并将对象返回到std_scaler.fit
方法的输入,其中std_scaler
是{self
(在本例中为std_标量),因为fit
方法返回self
但结果是
^{pr2}$管道里发生了什么?在
目前没有回答
相关问题 更多 >
编程相关推荐