斯坦福机器学习-week 3 学习笔记(3)—— 解决Overfitting

keyword: Overfitting ,Regularization


目录
一.Overfitting的定义
二.解决Overfitting的方法
三.Regularization
四.Regularization时α值的影响

 


一.Overfitting的定义
    根据Andrew Ng的说法,overfitting的定义如下:If we have too many features,the learnde hypothesis may fit the training set very well,but fail to generalize to new examples.
    也就是说,Overfitting(过拟合)是指,对于训练样本的分类正确率很高,然而,对于测试集而言,会出现分类正确率很低的情况。



二.解决Overfitting的方法
斯坦福机器学习-week 3 学习笔记(3)—— 解决Overfitting_第1张图片




三.Regularization
    根据维基百科,In statistics and machine learning, regularization methods are used for model selection, in particular to prevent overfitting by penalizing models with extreme parameter values. The most common variants in machine learning are L₁ and L₂ regularization, which can be added to learning algorithms that minimize a loss function E(X, Y) by instead minimizing E(X, Y) + α‖w‖, where w is the model's weight vector, ‖·‖ is either the L₁ norm or the squared L₂ norm, and α is a hyperparameter tuned by cross-validation.


    也就是说,为了避免overfitting,在cost function中添加一项,可以将J(θ)转化为下面的形式
    


    进行了Regularization以后,合适的α值可以减少模型中那些比较复杂的部分的参数过大,从而减少模型出现Overfitting的可能。



四.Regularization时α值的影响
    合适的α值,能够减少Overfitting;
    较大的α值,能够产生underfitting;
    较小的α值,不能起到消除Overfitting的作用
     

























你可能感兴趣的:(机器学习,学习笔记)