python 实现对数据集的归一化的方法(0-1之间)
多数情况下,需要对数据集进行归一化处理,再对数据进行分析
#首先,引入两个库 ,numpy,sklearn from sklearn.preprocessing import MinMaxScaler import numpy as np #将csv文件导入矩阵当中 my_matrix = np.loadtxt(open("xxxx.csv"),delimiter=",",skiprows=0) #将数据集进行归一化处理 scaler = MinMaxScaler( ) scaler.fit(my_matrix) scaler.data_max_ my_matrix_normorlize=scaler.transform(my_matrix) #最后的my_matrix_normorlize 实现了归一化my_matrix_normorlize
完整未解释代码:
from sklearn.preprocessing import MinMaxScaler import numpy as np my_matrix = np.loadtxt(open("xxxx.csv"),delimiter=",",skiprows=0) scaler = MinMaxScaler( ) scaler.fit(my_matrix) scaler.data_max_ my_matrix_normorlize=scaler.transform(my_matrix)
相关推荐
alanlonglong 2020-11-11
Iamthedoctor 2020-09-08
Site 2020-08-20
83327712 2020-07-30
zhaorui0 2020-06-09
hnyzyty 2020-06-04
LetItBe 2020-02-18
卖小孩的咖啡 2020-01-19
GhostLWB 2020-01-18
GerwelsJI 2020-01-11
ALLWITHLOVE 2019-12-29
xiaoxue 2019-11-08
xueyuediana 2019-09-21
yishujixiaoxiao 2019-11-01
DataCastle 2013-03-23
santiago00 2012-09-24
hualalalalali 2019-07-01
kinghighbury 2019-06-30
mori 2019-06-27