机器学习笔记之特征缩放

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值