Regularization
来源:互联网 发布:mac os ie内核浏览器 编辑:程序博客网 时间:2024/06/04 23:42
Regularization
The problem of overfitting
Overfitting
if we have too many features, the learned Hypothesis may fit training set very well (
J(θ)=12m∑mi=1(hθ(x(i)−y(i))2≈0 ), but fail to generalize to new examples。
如果我们的学习函数有许多的特征, 也许这个函数可以“完美” 的拟合我们的训练数据,但这很有可能对于一个新的样本造成错误的判断。
Generalize
Generalize refer to how well a Hypothesis applies even to new examples。
泛化指学习函数适用于新样本的能力
学习函数不能很好的拟合样本 –> Underfit or High bias
出现过拟合 : Overfit or High variance
Options
- Reduce number of features.
- Manaually select which features to keep.
- Model selection algorithm
- Regularization
- Keep all the features, but reduce magnitude / values of parameters
θj - Works well when we have a lot of features, each of which contributes a bit predicting
y 。
Cost Function
为了使得
为了可以使
这里的
Regularized Linear regression
Gradient descent
在普通的线性回归方程中, 我们用梯度下降算法计算
而对
其实就是简单的求一次偏导。整理得
可以发现, 正规化其实就是把
Normal equation
标准方程中, 我们可以用
而带正规化的标准方程的式子有一点变化,(根据梯度下降推导)
在进行标准方程计算的时候,
Regularized Logistics regression
Gradient descent
逻辑回归和线性回归的梯度下降算法中, 式子的形式是一样的,只是其中的 Hypothesis 不一样。
在编写 Octave 的 CostFunction 的时候, 对于每一个梯度 gradient ,记得及时加上
function [jVal, gradient] = costFunction(theta) jVal = [code to compute (J of theta)] gradient(1) = [code to compute (gradient1 of the theta_0)] gradient(2) = [code to compute (gradient1 of the theta_1)] * * gradient(n+1) = [code to compute (gradient1 of the theta_n)]
- Regularization
- Regularization
- Regularization
- Regularization
- 5-Regularization
- Regularization Exercise
- ML_note:Regularization
- Task3 regularization
- Regularization (mathematics)
- deeplearning-Regularization
- 正则化(regularization)
- ML:logistic Regression & Regularization
- Exercise 5: Regularization
- 正则化(regularization)
- 正则化(regularization)
- Regularization and Ridge Regression
- 【machine learning】regularization
- Regularization线性回归练习
- 安卓高德地图定位篇-(1)
- Mockito与Spring中@Autowired与@InjectMocks组合
- 有向图—朱刘算法模板
- 牛客网《剑指Offer》 矩形覆盖
- NYOJ 90 整数划分
- Regularization
- C++ Primer学习笔记(unit 2 变量和基本类型 -标识符
- 七个习惯
- 无用的探索
- angularjs知识点三过滤器
- 17年暑假计划
- java学习(4) 五子棋 小程序
- c++ Premier 学习笔记(unit2 变量和基本类型 -引用
- 方法 重载 递归