ML Note Course 1 Week 3-2: Over-fitting and Under-fitting
Generalization 泛化
means the model can make good predictions even on brand new examples that it has never seen before.
Under-fitting(high bias)
means the model does not fit the training set well, which is also called high bias.
Addressing Under-fitting
-
Add more features as input
-
Redesign a more complex model
Over-fitting(high-variance,高方差)
means the model fits the training set too well to generalize to new examples that’s never seen before.
Addressing Over-fitting
- Collect more training data
- Feature Selection: Select features to include/exclude:
all features + insufficient data ==> over-fit - Regularization 正则化: reduce size of parameters
Regularization
希望取得一个较为平滑的曲线,但又不能过于平滑。
在特征参数过多时,往往不知道哪些重要,哪些需要惩罚,因此,正则化时,选择惩罚所有参数, 通过为Cost Function 加上下面这一项regularization term.(关注曲线平滑程度,故不需要考虑)
其中,m为数据集大小,n为参数个数, 称为regularization parameter,.
Regularized Linear Regression and Logistic Regression
由于对线性回归和逻辑回归采取正则化,其Gradient Descent的表达式也有所调整.
其中, 有关的部分多了一项,如下所示.而b的部分不变,因为没有对它进行正则化.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 GuMorming!