标签:near style src rom .com linear model numpy http
实现:
# -*- coding: UTF-8 -*-
import numpy as np
from 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)
结果:
标签:near style src rom .com linear model numpy http
原文地址:https://www.cnblogs.com/yszd/p/9280623.html