对神经网络的输入进行归一化有什么好处?

What are the benefits of normalization of the inputs for neural networks?

对神经网络的输入进行归一化有什么好处?

我注意到它降低了梯度,但我不确定它是否真的会产生好的结果。

this answer

中有说明

If the input variables are combined linearly, as in an MLP, then it is rarely strictly necessary to standardize the inputs, at least in theory. The reason is that any rescaling of an input vector can be effectively undone by changing the corresponding weights and biases, leaving you with the exact same outputs as you had before. However, there are a variety of practical reasons why standardizing the inputs can make training faster and reduce the chances of getting stuck in local optima. Also, weight decay and Bayesian estimation can be done more conveniently with standardized inputs.

特征缩放使所有特征在梯度下降过程中的贡献相等,使优化更快。

如果你想象一个有两个变量的机器学习问题,一个在 10 的尺度上,另一个在 1,000,000 的尺度上,梯度下降会认为几乎所有的错误都在第二个特征,即使两个特征的相对误差相似。

您可以将上述情况的误差面想象成一条细长的沟谷,如果我们将两个正交方向同等重要地对待,则很难找到这种沟谷的确切底部。

特征缩放迫使峡谷变成一个漂亮的圆形 "bowl",并且更容易收敛到确切的底部,因为优化算法不会被任何巨大的压倒性特征分散注意力。


另请记住,特征缩放不会改变特征中最佳点的相对位置 space。以线性回归为例——如果一个特征被一个常数缩放c,这个特征的权重将进行相反的变换,最终得到相同的答案。

w = inv(X'*X)*X'*y

现在尝试用重新缩放的版本 QC 替换特征 X,其中 C 是对角列缩放矩阵。

w = inv(C'*Q'*Q*C)*C'*Q'*y
w = inv(C)*inv(Q'*Q)*inv(C')*C'*Q'*y
Cw = inv(Q'*Q)*Q'*y

因此使用新的缩放特征 Q=X*inv(C) 将为我们提供新的权重 u=Cw 和相同的解决方案 y