10. Advice for applying machine learning

Advice for applying machine learning

Deciding what to try next

Debugging a learining algorithm:

  • Get more training set. (Sometimes doesn't actrully help)
  • Try smaller sets of features. ()
  • Try getting additional features
  • Try adding polynomial features
  • Try decreasing or increasing \lambda

Machine learning diagnostic: save your time.

Evaluating a hypothesis

Test your hypothesis whether overfitting or not:

  • Split your training into 2 part.one is Training set (70%),another is Test set(30%).

Training/testing procedure for logistic regression

  • Learn parameter \theta from training data
  • Compute test set error (liner/logistic regression)
  • Misclassification error (logistic regression)

Model selection and training/validation/test sets

when using J(\Theta) to select which model to choose, overfitting may be happen and the result the model perform best isn't generlized.
J_{test}(\theta^{(5)} is likely to be an optimistic estimate of generalization error.

Split the dataset into 3 pieces.

  • training set (60%)
  • cross validation set (20%)
  • testing set (20%)

Use the cross validation to select model.
Use the testing set to test the generlazation error.

Diagnosing bias vs. variance

underfitting overfitting

Bias (underfit): J_{train}(\Theta) will be high; J_{cv}(\Theta)\approx J_{train}(\Theta)
Variance(overfit): J_{trian} will be low; J_{cv}(\Theta)\gg J_{train}(\Theta)

Regularization and bias/variance

To find a good \lambda
Try 0 0.01 0.02 0.04 0.08 ...10.24
Get many \Theta.
Use cross validation set to compute J_{cv}(\Theta), pick the minium of these J_{cv}(\Theta)

There are two figure in the two videos before, it's very useful to help to understand how the cross validation set helps to get best model and best \lambda

Learing curves

  • J_{train}(\theta)
  • J_{cv}(\theta)

error to m (training set size)

If a learing algorithe is suffering from high bies, getting more training data will not help much.

If a learning algorithm is suffering from high variance, getting more training data is likely to help .

Deciding what to try next (revisited)

bias: underfit
varaance: overfit

  • Get more training examples: fix high variance
  • Try smaller sets of features: fix high variance
  • Try getting additional features: fix high bias
  • Try adding polynomial features: fix high bias
  • Try decreasiong \lambda: fix high bias
  • Try increasing \lambda: fix high variance
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容