1

我正在使用 MLxtend StackingRegressor 并且我的元回归器是一个 sklearn 管道对象。模型拟合后,我想打印系数,但我无法做到这一点。

model3 = make_pipeline(PolynomialFeatures(2), LinearRegression())
model4 = StackingRegressor(regressors=[model1, model2], meta_regressor=model3)
model4.fit(train, target)
print(model4.coef_) #1
print(model4.steps[1][1].coef_) #2

在 #1 中,我收到一个错误,即管道对象没有属性 coef_,在 #2 中,我收到一个错误,即 StackingRegressor 没有属性步骤。

感谢您的帮助。

4

0 回答 0