python 调用sklearn 归一化和标准化、训练集验证集随机划分

#Z-Score标准化
from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
scaler.fit(train_X)
data_1 = scaler.transform(data_1)

#最大最小值归一化
from sklearn.preprocessing import MinMaxScaler

scaler = MinMaxScaler()
data_1 = scaler.transform(data_1)

训练集和测试集划分
train,validation = train_test_split(train_X, train_size = 0.7, random_state = 1)

 

你可能感兴趣的:(python 调用sklearn 归一化和标准化、训练集验证集随机划分)