过拟合问题
解决过拟合的方法
- 减少特征的个数
- Manually select which features to keep.
- Model selection algorithm
- 正则化(不减少特征个数)
- Keep all the features, but reduce magnitude/values of parameters.
- Works well when we have a lot of features, each of which contributes a bit to predicting .
代价函数
在代价函数中增加正则化项
增加正则化项,使, 趋于0.
如何选择正则化参数
线性回归的正则化
Gradient descent
Normal equation
正规方程的正则化方法