实现:# -*- coding: UTF-8 -*- import numpy as npfrom sklearn.linear_model import Ridge __author__ = ‘zhen‘ X = 2 * np.random.rand(100, 1)y = 4 + 3 * X + np.random.randn(100, 1)# 岭回归ridge_reg = Ridge(alpha=1, solver=‘sag‘)ridge_reg.fit(X, y)print("="*50)print(ridge_reg.predict(1.5))print(ridge_reg.intercept_)print(ridge_reg.coef_)print("="*50)结果:
原文地址:https://www.cnblogs.com/yszd/p/9280623.html
时间: 2024-11-09 03:55:39