1886 年, Francis Galton
研究父母身高与子女身高的关系时,发现了一个奇特现象:极端身高的父母,其子女身高往往更接近平均值。他创造了"regression
toward the
mean"(向均值回归)这个术语,这就是"回归"一词的由来。但线性回归的真正力量不在于统计描述,而在于它是几乎所有机器学习算法的数学基础——从神经网络到支持向量机,都可以看作线性回归的推广。
import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler
Normal Equation: 训练 R ²: 0.9452 测试 R ²: 0.9387 测试 RMSE: 19.87
Batch GD: 训练 R ²: 0.9452 测试 R ²: 0.9387 测试 RMSE: 19.87
SGD: 训练 R ²: 0.9449 测试 R ²: 0.9385 测试 RMSE: 19.91
Mini-batch GD: 训练 R ²: 0.9451 测试 R ²: 0.9386 测试 RMSE: 19.88
====================================================================== Ridge 回归:正则化参数选择 ====================================================================== λ= 0.00: 训练 R ²=0.9452, 测试 R ²=0.9387 λ= 0.01: 训练 R ²=0.9452, 测试 R ²=0.9387 λ= 0.10: 训练 R ²=0.9451, 测试 R ²=0.9388 λ= 1.00: 训练 R ²=0.9442, 测试 R ²=0.9391 λ= 10.00: 训练 R ²=0.9361, 测试 R ²=0.9372 λ=100.00: 训练 R ²=0.8647, 测试 R ²=0.8723
Hastie, T., Tibshirani, R., & Friedman, J. (2009).
The Elements of Statistical Learning (2nd ed.).
Springer.
Bishop, C. M. (2006). Pattern Recognition and Machine
Learning. Springer.
Murphy, K. P. (2012). Machine Learning: A Probabilistic
Perspective. MIT Press.
Shalev-Shwartz, S., & Ben-David, S. (2014).
Understanding Machine Learning: From Theory to
Algorithms. Cambridge University Press.
Goodfellow, I., Bengio, Y., & Courville, A. (2016).
Deep Learning. MIT Press.
James, G., Witten, D., Hastie, T., & Tibshirani, R. (2013).
An Introduction to Statistical Learning.
Springer.
Tibshirani, R. (1996). Regression shrinkage and selection
via the lasso. Journal of the Royal Statistical Society:
Series B, 58(1), 267-288.
Hoerl, A. E., & Kennard, R. W. (1970). Ridge
regression: Biased estimation for nonorthogonal problems.
Technometrics, 12(1), 55-67.
Zou, H., & Hastie, T. (2005). Regularization and
variable selection via the elastic net. Journal of the
Royal Statistical Society: Series B, 67(2), 301-320.
Huber, P. J. (1964). Robust estimation of a location
parameter. The Annals of Mathematical Statistics,
35(1), 73-101.