API
- 正则化力度越大,权重系数越小
- 正则化力度越小,权重系数越大
from sklearn.linear_model import Ridge
estimator = Ridge(max_iter=1000)
estimator.fit(x_train,y_train)
y_predict = estimator.predict(x_test)
print("预测房价:\n",y_predict)
error = mean_squared_error(y_test,y_predict)
print("岭回归-均方误差:\n",error)
print("岭回归权重系数为:\n",estimator.coef_)
print("岭回归偏值为:\n",estimator.intercept_)
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 WangZun233!