机器学习笔记之特征缩放
2017-07-10 08:30
295 查看
GradientDescent in Practice I - Feature Scaling
Note: [6:20 -The average size of a house is 1000 but 100 is accidentally written instead]
We can speed upgradient descent by having each of our input values in roughly the same range.This is because θ will descend quickly on small ranges and slowly on largeranges, and
so will oscillate inefficiently down to the optimum when thevariables are very uneven.
The way toprevent this is to modify the ranges of our input variables so that they areall roughly the same. Ideally:
−1 ≤ x(i) ≤
1
or
−0.5 ≤ x(i) ≤
0.5
These aren'texact requirements; we are only trying to speed things up. The goal is to getall input variables into roughly one of these ranges, give or take a few.
Two techniquesto help with this are feature scaling and meannormalization. Feature scaling involves dividing the input values by therange (i.e.
the maximum value minus the minimum value) of the input variable,resulting in a new range of just 1. Mean normalization involves subtracting theaverage value for an input variable from the values for that input variableresulting in a new average value for
the input variable of just zero. Toimplement both of these techniques, adjust your input values as shown in thisformula:
xi:=(xi−μi)/si
Where μi isthe average of all the values for feature
(i) and si is therange of values (max - min), or si is
thestandard deviation.
Note thatdividing by the range, or dividing by the standard deviation, give differentresults. The quizzes in this course use range - the programming exercises usestandard deviation.
For example,if xi represents housing prices with arange of 100
to 2000 and a mean value of 1000, then, xi:=(price−1000)/1900.
Note: [6:20 -The average size of a house is 1000 but 100 is accidentally written instead]
We can speed upgradient descent by having each of our input values in roughly the same range.This is because θ will descend quickly on small ranges and slowly on largeranges, and
so will oscillate inefficiently down to the optimum when thevariables are very uneven.
The way toprevent this is to modify the ranges of our input variables so that they areall roughly the same. Ideally:
−1 ≤ x(i) ≤
1
or
−0.5 ≤ x(i) ≤
0.5
These aren'texact requirements; we are only trying to speed things up. The goal is to getall input variables into roughly one of these ranges, give or take a few.
Two techniquesto help with this are feature scaling and meannormalization. Feature scaling involves dividing the input values by therange (i.e.
the maximum value minus the minimum value) of the input variable,resulting in a new range of just 1. Mean normalization involves subtracting theaverage value for an input variable from the values for that input variableresulting in a new average value for
the input variable of just zero. Toimplement both of these techniques, adjust your input values as shown in thisformula:
xi:=(xi−μi)/si
Where μi isthe average of all the values for feature
(i) and si is therange of values (max - min), or si is
thestandard deviation.
Note thatdividing by the range, or dividing by the standard deviation, give differentresults. The quizzes in this course use range - the programming exercises usestandard deviation.
For example,if xi represents housing prices with arange of 100
to 2000 and a mean value of 1000, then, xi:=(price−1000)/1900.
相关文章推荐
- 机器学习中的特征缩放(feature scaling)浅谈
- 机器学习-梯度下降算法-特征缩放和学习速率选取
- 斯坦福机器学习公开课4-3 4-4 特征缩放和验证梯度下降算法
- 激光雷达学习笔记(三)特征提取
- php学习笔记(十六)图片的处理缩放、旋转、透明、锐化、翻转、裁剪
- SAP BW R3应用_特征数据的加载——视频学习笔记07
- opencv学习笔记:特征点匹配函数使用注意
- 学习笔记:silktest怎样判断本机器的操作系统(1)
- 图像编程学习笔记7——图像缩放
- 机器学习学习笔记 - 梯度下降
- Java 面向对象的特征---学习笔记
- 斯坦福机器学习公开课笔记(二)--多变量线性回归
- Java学习笔记1------面向对象的三个基本特征
- OpenCV学习笔记(29)KAZE 算法原理与源码分析(三)特征检测与描述
- OpenCV学习笔记(29)KAZE 算法原理与源码分析(三)特征检测与描述
- C++学习笔记二十六-固有的不可移植的特征
- 程序机器级表示学习笔记一
- 机器学习-学习笔记3.1-局部加权回归
- JavaScript 学习笔记之一jQuery写法图片等比缩放以及预加载
- Coursera公开课笔记: 斯坦福大学机器学习第十一课“机器学习系统设计(Machine learning system design)”