第八章:多项式回归与模型泛化
准备数据
import numpy as np
import matplotlib.pyplot as plt
x = np.random.uniform(-3, 3, size=100)
X = x. reshape(-1, 1)
y = 0.5 * x**2 + x + 2 + np.random.normal(0, 1, size=100)
plt.scatter(X, y)
plt.show()
使用线性回归

解决方案, 添加一个特征

结论
Last updated
