机器学习- 吴恩达Andrew Ng - week3-4 solve overfitting
Posted 架构师易筋
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了机器学习- 吴恩达Andrew Ng - week3-4 solve overfitting相关的知识,希望对你有一定的参考价值。
Coursera课程地址
因为Coursera的课程还有考试和论坛,后续的笔记是基于Coursera
https://www.coursera.org/learn/machine-learning/home/welcome
Solving the Problem of overfitting
1. The Problem of overfitting 过拟合 - Regression
Linear regression 线性回归问题,解法的问题分类:
- underfit, High bias 不够准确
- Just right 刚刚好
- overfit过拟合, Hig variance 参数太多,导致新数据的预测比较差
分类的解法一样有同样的问题: - underfit, High bias 不够准确
- Just right 刚刚好
- overfit过拟合, Hig variance 参数太多,导致新数据的预测比较差
解决过拟合Overfitting: 减少不重要的参数
解决过拟合Overfitting: - 减少不重要的参数
- 或者降低不重要参数的权重
2. Cost function - Regression
如果要penalize处罚某些参数,可以乘以某个大数,比如1000,则前面的系数可以θ≈0
挨个参数的系数去适配,用如下公式
预测房价适配参数的系数例子
如果λ过大,则只剩下θ0,就变成一个常数,也就是不拟合了。
优化Overfit 过拟合的公式:
3. Regularized linear regression - Regularization
正规方程:线性回归方法 Regularized linear regression
梯度下降方法
标准方程Normal equation
Non-invertibility不可逆矩阵。可以证明,λ > 0
的情况下,都是有可逆矩阵。
4. Regularized logistic regression - Regularization
正规方法:分类回归 Regularized logistic regression
梯度下降算法:Gradient descent
高级优化算法:Advanced optimization
线性回归能耗工程 cost function for logistic regression:
正规方程:线性回归能耗工程 cost function for logistic regression:
week 3 的上机作业,请用这个链接下载。
https://s3.amazonaws.com/spark-public/ml/exercises/on-demand/machine-learning-ex2.zip
参考论坛
https://www.coursera.org/learn/machine-learning/discussions/forums/vo9wKSgeEeaZ8Apto8QB_w/threads/VGlLCbsmEeu8TRLTS18hVQ
需要重复加强的地方
搜索关键词:doglegm error
The “doglegm” error is discussed in the FAQ thread in the Week 3 Discussion Forum.
showing error in doglegm method of fminunc function
error: operator \\: nonconformant arguments (op1 is 3x3, op2 is 1x1)
error: called from
fminunc>__doglegm__ at line 466 column 5
fminunc at line 274 column 9
ex2 at line 98 column 15
See the page “Programming tips from Mentors” in the Week 2 materials.
Week 3
Discuss and ask questions about Week 3.
https://www.coursera.org/learn/machine-learning/discussions/all/threads/JHorKeknEeS0tyIAC9RBcw
以上是关于机器学习- 吴恩达Andrew Ng - week3-4 solve overfitting的主要内容,如果未能解决你的问题,请参考以下文章
机器学习- 吴恩达Andrew Ng - week3-4 solve overfitting
机器学习- 吴恩达Andrew Ng 编程作业技巧 for Week3
机器学习- 吴恩达Andrew Ng Week1 知识总结 Introduciton
机器学习- 吴恩达Andrew Ng Week11 知识总结 Photo OCR