Machine Learning——错题整理(第二周)

Which of the following are reasons for using feature scaling?

为什么要使用特征缩放?

 

A.It prevents the matrix XTX (used in the normal equation) from being non-invertable (singular/degenerate).

B.It speeds up gradient descent by making it require fewer iterations to get to a good solution.

加快了梯度下降,通过更少的迭代来达到一个好的结果

C.It speeds up gradient descent by making each iteration of gradient descent less expensive to compute.

每一次迭代的较少计算成本来加快梯度下降

D.It is necessary to prevent the normal equation from getting stuck in local optima.

防止陷入局部最优

 

 

正确答案是B.

It speeds up gradient descent by making it require fewer iterations to get to a good solution.

【解析】Feature scaling speeds up gradient descent by avoiding many extra iterations that are required when one or more features take on much larger values than the rest.The cost function J(θ) for linear regression has no local optima.The magnitude of the feature values are insignificant in terms of computational cost.

特征缩放是通过避免当一个或多个特征的值大于其余值所需的额外迭代而加速梯度下降。线性回归的成本函数J(θ)没有局部最优

 

 

不好意思又把一年前的博客文拿出来了,添加一些新的理解。

结合李宏毅的课件,整理一下我的思路:

比如你有两个输入的特征x1,x2(y=w1x1+w2x2+b),如果两个特征的分布范围很不一样,就最好做特征缩放。

也就是Feature Scaling的目的是make different features have the same scaling。

为什么呢?

继续用之前的例子。

x1小,x2大,那么改变w1对y的影响就很小,而略微改变w2对y的影响就很大。这样子做出来的损失函数的样子就是一个扁扁的椭圆。

放上课件上的图

 

 

可以看到左边就是上面所说的情况,这样的情况下做梯度下降就会比较难。因为对学习率的改变要求很大。

而右边相对就会容易很多,因为由于是偏向正圆,无论在哪个点开始做梯度下降都会向着圆心走。

所以做梯度缩放就是让Loss L更接近圆,使得梯度下降更有效率。

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

故沉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值