更新时间:2022-11-03 22:14:34
您应该使用输出
cross_validate
的值以获取拟合模型的参数。原因是 cross_validate
会克隆管道。因此,在馈给 cross_validate
之后,您将找不到给定的管道
变量是否适合。
You should use the output
of cross_validate
to get the parameters of the fitted model. The reason is that cross_validate
would clone the pipeline. Hence you would not find given pipeline
variable be fitted after been fed to cross_validate
.
output
是字典,其中以 estimator
作为键之一,其值为a k_fold
个已拟合管道
对象的数量。
output
is dictionary, which has estimator
as one of the keys, whose value is a k_fold
number of fitted pipeline
objects.
来自 文档 :
return_estimator:布尔值,默认为False
return_estimator : boolean, default False
是否返回每个分割拟合的估计量。
Whether to return the estimators fitted on each split.
尝试一下!
>>> fitted_svc = output['estimator'][0].named_steps['svm'] # choosing the first fold comb
>>> fitted_svc.coef_
array([[1.05826838, 0.41630046]])