from sklearn.datasets import load_iris iris=load_iris() #Z-score 数据标准化 from sklearn.preprocessing import StandardScaler data_standard=StandardScaler().fit_transform(iris.data) # print('data_standard',data_standard) #Min-Max from sklearn.preprocessing import MinMaxScaler data_min_max=MinMaxScaler().fit_transform(iris.data) # print('data_min_max',data_min_max) #Normaizer归一化 from sklearn.preprocessing import Normalizer data_norm=Normalizer().fit_transform(iris.data) # print('data_norm',data_norm) #对定量特征二只化,大于3为1,小于3为0 from sklearn.preprocessing import Binarizer data_bin=Binarizer(threshold=3).fit_transform(iris.data) # print('data_bin',data_bin) #对数变换 from numpy import log1p from sklearn.preprocessing import FunctionTransformer data_log=FunctionTransformer(log1p).fit_transform(iris.data) # print('data_log',data_log)