pipeline与make_pipeline

顾高扬
2023-12-01

pipeline与make_pipeline唯一的区别就是pipeline需要为转换器和评估器起名字,而make_pipeline自动为转换器和评估器生成名字

可以看一下面的例子

from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
clf1 = Pipeline(
	[("scale", StadardScaler()),
	 ("svc", SVC(gamma=auto))
	]
)
clf1.set_params(svc__C = 1.0)

clf2 = make_pipeline(StandardScale(),SVC)
clf2.setparams(svc__C = 1.0)
 类似资料: