What is normalization, and what is the difference between it and standardization?

Normalization is mainly used in places where there is no distance calculation, while standardization is used in places that are not related to weights, because
the benefits of distance information and weight information normalization are lost respectively :
1. Avoid numerical problems. 2. Make the network converge quickly. 3. The evaluation criteria of the sample data are different, and it needs to be dimensioned and unified evaluation criteria

4. The sigmoid function is often used as the transfer function in bp, and normalization can prevent the saturation of neuron output caused by the excessive absolute value of the net input.

5. Ensure that the small value in the output data is not swallowed.

When to use normalization and when to use standardization:

1. If there is a requirement for the output result range, use normalization

2. If the data is relatively stable and there is no extreme maximum or minimum value, use normalization

3. If the data has outliers and a lot of noise, use standardization to avoid the influence of outliers and extreme values ​​indirectly through centralization

In order to illustrate the difference between the two vividly, you can understand the
so-called "normalization" as follows . Pay attention to "one", which means to classify the data into the interval (0, 1).
Commonly used methods are: min-max normalized y=(x-min)/(max-min)

The so-called "standard" is the standard normal distribution, which converts the data into a standard normal distribution.
Commonly used methods are: z-score standardization, that is, zero-mean standardization, y=(x-μ)/σ

Deep learning normalization problem:
benefits:
1. Reduce the input space, thereby reducing the difficulty of tuning parameters;
2. Prevent the gradient from exploding/disappearing, thereby accelerating network convergence.
BN reduces the input space during feedforward, and the input space during feedforward directly affects the gradient condition during feedback calculation. So, BN actually helped alleviate the gradient problem.
Calculation method:
1. Calculate the mean and variance of the batch data;
2. Normalize the batch data accordingly;
3. Multiply the scaling matrix and add the translation vector.

一.不同点

标准差与权重:某个指标数据对应的数据集标准差过大,说明其不确定性增加,所提供的信息量也会增加,因此在进行综合指标评价的时候,权重也会对应的增大.—-类似熵权法

二.相同点及其联系
  1 联系:归一化广义上是包含标准化的,Z-Score方法也是归一化的方法之一,在这里主要是从狭义上,区分两者   
  2 本质上都是进行特征提取,方便最终的数据比较认识.都通过先平移(分子相减)后缩放(分母)进行进行提取;
  3 都是为了缩小范围.便于后续的数据处理.
  4 作用:(重点)
    i) 加快梯度下降,损失函数收敛;—速度上
    ii) 提升模型精度–也就是分类准确率.(消除不同量纲,便于综合指标评价,提高分类准确率)—质量上
    iii) 防止梯度爆炸(消除因为数据输入差距(1和2000)过大,而带来的输出差距过大(0.8,999),进而在 反向传播的过程当中,导致梯度过大(因为反向传播的过程当中进行梯度计算,会使用的之前对应层的输入x),从而形成梯度爆炸)—稳定性上

说明:特征缩放其实并不需要太精确,其目的只是为了让梯度下降能够运行得更快一点,让梯度下降收敛所需的循环次数更少一些而已。

三.归一化(广义)的场景
  A. 除非本来各维数据的分布范围就比较接近,否则必须进行标准化,以免模型参数被分布范围较大或较小的数据支配
  B. 数据分布差异比较大–标准化和奇异数据(单个有影响的也要)–归一化

3.1 特征/数据需要归一化的场景
  ①logistic regression模型:逻辑回归,虽然迭代若几次没有影响,但实际当中远不止若干次,这样就会导致逻辑回归模型的目标函数过于扁化,导致梯度很难下降,不容易得到较好的模型参数.
  ②SVM模型:因为涉及到向量/数据的距离(向量之间差异过大/过小,就会导致最佳分离超平面可能会由最大/远或者最小/近的几个向量支配,导致鲁棒性较差,因此需要进行标准化—可以保留向量间的模型)
  ③NeuralNetwork模型:初始输入值过大,反向传播时容易梯度爆炸(上面有解释)
  ④SGD:加快梯度下降.

3.2 不需要归一化的场景
    1 0/1取值的特征通常不需要归一化,归一化会破坏它的稀疏性
    2 决策树,原因详见:https://www.julyedu.com/question/big/kp_id/23/ques_id/923
    3 基于平方损失的最小二乘法OLS不需要归一化(因为本质上是一个抛物线,强凸函数,下降速度快.)

四.归一化(狭义)注意事项:
4.1 归一化的方法
4.1.1 小数定标标准化这种方法通过移动数据的小数点位置来进行标准化。小数点移动多少位取决于属性A的取值中的最大绝对值。将属性A的原始值x使用decimal scaling标准化到x’的计算方法是:
x'=x/(10^j),其中,j是满足条件的最小整数。例如 假定A的值由-986到917,A的最大绝对值为986,为使用小数定标标准化,我们用1000(即,j=3)除以每个值,这样,-986被规范化为-0.986。

注意,标准化会对原始数据做出改变,因此需要保存所使用的标准化方法的参数,以便对后续的数据进行统一的标准化。

4.1.2 softmax对数归一化


4.1.3 L2归一化


上图所示,L2归一化过程:其实就是x本身/2范数

4.2 指标衡量与权重保留  
在归一化中,指标之间其实一般都存在单位的标准问题,例如:我们评价一个人的健康程度,有如下指标,假设一个人身高 180cm,体重 70kg,白细胞计数7.50×10^{9}/L,各个量纲都不一样,因此归一化就是消除各个量纲,然后将各个指标结合起来,共同参与到评价健康程度当中,这个就是归一化需要做的事情–消除量纲,便于数据(结合了各个指标的健康程度)/综合评价的比较。

因此我们在进行归一化的时候,我们就需要对各个指标的权重进行保留,方便评价.

4.3 归一化的使用前提  
在存在奇异样本数据的情况下,进行训练之前最好进行归一化,如果不存在奇异样本数据,则可以不用归一化

五.标准化的过程
即零-均值标准化

其中 u是样本数据的均值(mean),是样本数据的标准差(std)。


上图则是一个散点序列的标准化过程:原图->减去均值(均值为0–>数据以原点为中心)->除以标准差对应到三维图像(以损失函数为例)机器学习的目标无非就是不断优化损失函数,使其值最小。在上图中,J(w,b)就是我们要优化的目标函数,在上图中,我们可以看到,损失函数,未处理之前:梯度的方向就会偏离最小值的方向,走很多弯路,经过标准化处理之后,我们损失函数的曲线也变得比较圆,有利于加快梯度下降,加快找到最佳模型参数.具体如下图:

标准化前

标准化后

六.参考文献归一化与标准化-博客园
归一化与标准化
归一化、标准化区别的通俗说法

 



 

Guess you like

Origin blog.csdn.net/guyu1003/article/details/108458131