当前位置:网站首页>【AI实战】机器学习数据处理之数据归一化、标准化
【AI实战】机器学习数据处理之数据归一化、标准化
2022-06-23 06:24:00 【szZack】
机器学习数据处理之数据归一化、标准化
本文介绍三种归一化、标准化的方法。
1.min-max标准化(Min-max normalization)
对原始数据的线性变换,使结果落到[0,1]区间,转换函数如下:
x ∗ = x − m i n m a x − m i n x^*=\frac{x-min}{max-min} x∗=max−minx−min
- 注意事项
max,min 必须是固定的
2.z-score(标准差) 标准化
对原始数据的均值(mean)和标准差(standard deviation)进行数据的标准化。
经过处理的数据符合标准正态分布,即均值为0,标准差为1,其转化函数为:
x ∗ = x − μ σ x^* = \frac{x - μ }{σ} x∗=σx−μ
其中μ为所有样本数据的均值,σ为所有样本数据的标准差。
3.nonlinearity(非线性) 归一化
非线性归一化方法经常用在数据分化比较大的场景,有些数值很大,有些很小。通过一些数学函数,将原始值进行映射。
该方法包括 log,正切等,需要根据数据分布的情况,决定非线性函数的曲线:
对数函数转换方法
比如 y = l n ( x ) y = ln(x) y=ln(x),对应的归一化方法为:
x ∗ = l n ( x ) l n ( m a x ) x^*= \frac{ln(x)}{ln(max)} x∗=ln(max)ln(x)
其中 m a x max max 表示样本数据的最大值, x ∗ x^* x∗ 为标准化后值, x x x 为输入值,并且所有样本数据均要大于等于1.反正切函数转换方法
利用反正切函数可以实现数据的归一化,即
x ∗ = a r c t a n ( x ) ∗ ( 2 / p i ) x^*= arctan(x)*(2/pi) x∗=arctan(x)∗(2/pi)
使用这个方法需要注意的是如果想映射的区间为[0,1],则数据都应该大于等于0,小于0的数据将被映射到[-1,0]区间上.L2范数归一化方法
L2范数归一化就是特征向量中每个元素均除以向量的L2范数:
x i ∗ = x i n o r m ( x ) x_i^*= \frac{x_i}{norm(x)} xi∗=norm(x)xi
其中,向量 x ( x 1 , x 2 , . . . , x n ) x(x_1,x_2,...,x_n) x(x1,x2,...,xn)的L2范数定义为:
n o r m ( x ) = x 1 2 + x 2 2 + . . . + x 1 n norm(x)=\sqrt{x_1^2+x_2^2+...+x_1^n} norm(x)=x12+x22+...+x1n
特点:转换后的数据 x ∗ x^* x∗平方和为1
边栏推荐
猜你喜欢

云原生落地进入深水区,博云容器云产品族释放四大价值

Project_ Filter to solve Chinese garbled code

U-Net: Convolutional Networks for Biomedical Image Segmentation

Unet代码实现

EndNote20使用教程分享(未完

宝塔忘记密码

In depth learning series 47:stylegan summary
![[daily training] 513 Find the value in the lower left corner of the tree](/img/97/ab2179d6dbd0536e8cc139659aecc2.png)
[daily training] 513 Find the value in the lower left corner of the tree

GINet

How to migrate virtual machines from VirtualBox to hype-v
随机推荐
细说Idea那些骚操作
303. region and retrieval - array immutable
Nacos适配oracle11g-建表ddl语句
Why does TCP protocol shake hands three times instead of two?
npm下载报错npm ERR code ERESOLVE
407-栈与队列(232.用栈实现队列、225. 用队列实现栈)
Too much if logic in JS, common optimization
300. 最长递增子序列
[shell] tree command
SSTable详解
宝塔忘记密码
Nacos适配oracle11g-修改Nacos源码
About professional attitude
U-Net: Convolutional Networks for Biomedical Image Segmentation
Project_ Filter to solve Chinese garbled code
Eureka
[project training] multi segment line expanded to parallel line
318. 最大单词长度乘积
C language learning summary
20220621 Three Conjugates of Dual Quaternions