使用sklearn进行量纲缩放的程序

2021/7/20 20:09:46

本文主要是介绍使用sklearn进行量纲缩放的程序,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

使用sklearn进行量纲缩放的程序

# -*- coding: utf-8 -*-
"""
演示内容:量纲的特征缩放
(两种方法:标准化缩放法和区间缩放法。每种方法举了两个例子:简单二维矩阵和iris数据集)
"""
#方法1:标准化缩放法 例1:对简单示例二维矩阵的列数据进行
from sklearn import preprocessing   
import numpy as np  
#采用numpy的array表示,因为要用到其mean等函数,而list没有这些函数
X = np.array([[0, 0], 
        [0, 0], 
        [100, 1], 
        [1, 1]])  
# calculate mean  
X_mean = X.mean(axis=0)  
# calculate variance   
X_std = X.std(axis=0)  
#print (X_std)
# standardize X  
X1 = (X-X_mean)/X_std
print (X1)
print ("")

# we can also use function preprocessing.scale to standardize X  
X_scale = preprocessing.scale(X)  
print (X_scale)
[[-0.58504784 -1.        ]
 [-0.58504784 -1.        ]
 [ 1.73197332  1.        ]
 [-0.56187763  1.        ]]

[[-0.58504784 -1.        ]
 [-0.58504784 -1.        ]
 [ 1.73197332  1.        ]
 [-0.56187763  1.        ]]
#方法1: 标准化缩放法 例2:对iris数据二维矩阵的列数据进行。这次采用一个集成的方法StandardScaler
from sklearn import datasets
iris = datasets.load_iris()
X_scale = preprocessing.scale(iris.data)  
print (X_scale)
[[-9.00681170e-01  1.01900435e+00 -1.34022653e+00 -1.31544430e+00]
 [-1.14301691e+00 -1.31979479e-01 -1.34022653e+00 -1.31544430e+00]
 [-1.38535265e+00  3.28414053e-01 -1.39706395e+00 -1.31544430e+00]
 [-1.50652052e+00  9.82172869e-02 -1.28338910e+00 -1.31544430e+00]
 [-1.02184904e+00  1.24920112e+00 -1.34022653e+00 -1.31544430e+00]
 [-5.37177559e-01  1.93979142e+00 -1.16971425e+00 -1.05217993e+00]
 [-1.50652052e+00  7.88807586e-01 -1.34022653e+00 -1.18381211e+00]
 [-1.02184904e+00  7.88807586e-01 -1.28338910e+00 -1.31544430e+00]
 [-1.74885626e+00 -3.62176246e-01 -1.34022653e+00 -1.31544430e+00]
 [-1.14301691e+00  9.82172869e-02 -1.28338910e+00 -1.44707648e+00]
 [-5.37177559e-01  1.47939788e+00 -1.28338910e+00 -1.31544430e+00]
 [-1.26418478e+00  7.88807586e-01 -1.22655167e+00 -1.31544430e+00]
 [-1.26418478e+00 -1.31979479e-01 -1.34022653e+00 -1.44707648e+00]
 [-1.87002413e+00 -1.31979479e-01 -1.51073881e+00 -1.44707648e+00]
 [-5.25060772e-02  2.16998818e+00 -1.45390138e+00 -1.31544430e+00]
 [-1.73673948e-01  3.09077525e+00 -1.28338910e+00 -1.05217993e+00]
 [-5.37177559e-01  1.93979142e+00 -1.39706395e+00 -1.05217993e+00]
 [-9.00681170e-01  1.01900435e+00 -1.34022653e+00 -1.18381211e+00]
 [-1.73673948e-01  1.70959465e+00 -1.16971425e+00 -1.18381211e+00]
 [-9.00681170e-01  1.70959465e+00 -1.28338910e+00 -1.18381211e+00]
 [-5.37177559e-01  7.88807586e-01 -1.16971425e+00 -1.31544430e+00]
 [-9.00681170e-01  1.47939788e+00 -1.28338910e+00 -1.05217993e+00]
 [-1.50652052e+00  1.24920112e+00 -1.56757623e+00 -1.31544430e+00]
 [-9.00681170e-01  5.58610819e-01 -1.16971425e+00 -9.20547742e-01]
 [-1.26418478e+00  7.88807586e-01 -1.05603939e+00 -1.31544430e+00]
 [-1.02184904e+00 -1.31979479e-01 -1.22655167e+00 -1.31544430e+00]
 [-1.02184904e+00  7.88807586e-01 -1.22655167e+00 -1.05217993e+00]
 [-7.79513300e-01  1.01900435e+00 -1.28338910e+00 -1.31544430e+00]
 [-7.79513300e-01  7.88807586e-01 -1.34022653e+00 -1.31544430e+00]
 [-1.38535265e+00  3.28414053e-01 -1.22655167e+00 -1.31544430e+00]
 [-1.26418478e+00  9.82172869e-02 -1.22655167e+00 -1.31544430e+00]
 [-5.37177559e-01  7.88807586e-01 -1.28338910e+00 -1.05217993e+00]
 [-7.79513300e-01  2.40018495e+00 -1.28338910e+00 -1.44707648e+00]
 [-4.16009689e-01  2.63038172e+00 -1.34022653e+00 -1.31544430e+00]
 [-1.14301691e+00  9.82172869e-02 -1.28338910e+00 -1.31544430e+00]
 [-1.02184904e+00  3.28414053e-01 -1.45390138e+00 -1.31544430e+00]
 [-4.16009689e-01  1.01900435e+00 -1.39706395e+00 -1.31544430e+00]
 [-1.14301691e+00  1.24920112e+00 -1.34022653e+00 -1.44707648e+00]
 [-1.74885626e+00 -1.31979479e-01 -1.39706395e+00 -1.31544430e+00]
 [-9.00681170e-01  7.88807586e-01 -1.28338910e+00 -1.31544430e+00]
 [-1.02184904e+00  1.01900435e+00 -1.39706395e+00 -1.18381211e+00]
 [-1.62768839e+00 -1.74335684e+00 -1.39706395e+00 -1.18381211e+00]
 [-1.74885626e+00  3.28414053e-01 -1.39706395e+00 -1.31544430e+00]
 [-1.02184904e+00  1.01900435e+00 -1.22655167e+00 -7.88915558e-01]
 [-9.00681170e-01  1.70959465e+00 -1.05603939e+00 -1.05217993e+00]
 [-1.26418478e+00 -1.31979479e-01 -1.34022653e+00 -1.18381211e+00]
 [-9.00681170e-01  1.70959465e+00 -1.22655167e+00 -1.31544430e+00]
 [-1.50652052e+00  3.28414053e-01 -1.34022653e+00 -1.31544430e+00]
 [-6.58345429e-01  1.47939788e+00 -1.28338910e+00 -1.31544430e+00]
 [-1.02184904e+00  5.58610819e-01 -1.34022653e+00 -1.31544430e+00]
 [ 1.40150837e+00  3.28414053e-01  5.35408562e-01  2.64141916e-01]
 [ 6.74501145e-01  3.28414053e-01  4.21733708e-01  3.95774101e-01]
 [ 1.28034050e+00  9.82172869e-02  6.49083415e-01  3.95774101e-01]
 [-4.16009689e-01 -1.74335684e+00  1.37546573e-01  1.32509732e-01]
 [ 7.95669016e-01 -5.92373012e-01  4.78571135e-01  3.95774101e-01]
 [-1.73673948e-01 -5.92373012e-01  4.21733708e-01  1.32509732e-01]
 [ 5.53333275e-01  5.58610819e-01  5.35408562e-01  5.27406285e-01]
 [-1.14301691e+00 -1.51316008e+00 -2.60315415e-01 -2.62386821e-01]
 [ 9.16836886e-01 -3.62176246e-01  4.78571135e-01  1.32509732e-01]
 [-7.79513300e-01 -8.22569778e-01  8.07091462e-02  2.64141916e-01]
 [-1.02184904e+00 -2.43394714e+00 -1.46640561e-01 -2.62386821e-01]
 [ 6.86617933e-02 -1.31979479e-01  2.51221427e-01  3.95774101e-01]
 [ 1.89829664e-01 -1.97355361e+00  1.37546573e-01 -2.62386821e-01]
 [ 3.10997534e-01 -3.62176246e-01  5.35408562e-01  2.64141916e-01]
 [-2.94841818e-01 -3.62176246e-01 -8.98031345e-02  1.32509732e-01]
 [ 1.03800476e+00  9.82172869e-02  3.64896281e-01  2.64141916e-01]
 [-2.94841818e-01 -1.31979479e-01  4.21733708e-01  3.95774101e-01]
 [-5.25060772e-02 -8.22569778e-01  1.94384000e-01 -2.62386821e-01]
 [ 4.32165405e-01 -1.97355361e+00  4.21733708e-01  3.95774101e-01]
 [-2.94841818e-01 -1.28296331e+00  8.07091462e-02 -1.30754636e-01]
 [ 6.86617933e-02  3.28414053e-01  5.92245988e-01  7.90670654e-01]
 [ 3.10997534e-01 -5.92373012e-01  1.37546573e-01  1.32509732e-01]
 [ 5.53333275e-01 -1.28296331e+00  6.49083415e-01  3.95774101e-01]
 [ 3.10997534e-01 -5.92373012e-01  5.35408562e-01  8.77547895e-04]
 [ 6.74501145e-01 -3.62176246e-01  3.08058854e-01  1.32509732e-01]
 [ 9.16836886e-01 -1.31979479e-01  3.64896281e-01  2.64141916e-01]
 [ 1.15917263e+00 -5.92373012e-01  5.92245988e-01  2.64141916e-01]
 [ 1.03800476e+00 -1.31979479e-01  7.05920842e-01  6.59038469e-01]
 [ 1.89829664e-01 -3.62176246e-01  4.21733708e-01  3.95774101e-01]
 [-1.73673948e-01 -1.05276654e+00 -1.46640561e-01 -2.62386821e-01]
 [-4.16009689e-01 -1.51316008e+00  2.38717193e-02 -1.30754636e-01]
 [-4.16009689e-01 -1.51316008e+00 -3.29657076e-02 -2.62386821e-01]
 [-5.25060772e-02 -8.22569778e-01  8.07091462e-02  8.77547895e-04]
 [ 1.89829664e-01 -8.22569778e-01  7.62758269e-01  5.27406285e-01]
 [-5.37177559e-01 -1.31979479e-01  4.21733708e-01  3.95774101e-01]
 [ 1.89829664e-01  7.88807586e-01  4.21733708e-01  5.27406285e-01]
 [ 1.03800476e+00  9.82172869e-02  5.35408562e-01  3.95774101e-01]
 [ 5.53333275e-01 -1.74335684e+00  3.64896281e-01  1.32509732e-01]
 [-2.94841818e-01 -1.31979479e-01  1.94384000e-01  1.32509732e-01]
 [-4.16009689e-01 -1.28296331e+00  1.37546573e-01  1.32509732e-01]
 [-4.16009689e-01 -1.05276654e+00  3.64896281e-01  8.77547895e-04]
 [ 3.10997534e-01 -1.31979479e-01  4.78571135e-01  2.64141916e-01]
 [-5.25060772e-02 -1.05276654e+00  1.37546573e-01  8.77547895e-04]
 [-1.02184904e+00 -1.74335684e+00 -2.60315415e-01 -2.62386821e-01]
 [-2.94841818e-01 -8.22569778e-01  2.51221427e-01  1.32509732e-01]
 [-1.73673948e-01 -1.31979479e-01  2.51221427e-01  8.77547895e-04]
 [-1.73673948e-01 -3.62176246e-01  2.51221427e-01  1.32509732e-01]
 [ 4.32165405e-01 -3.62176246e-01  3.08058854e-01  1.32509732e-01]
 [-9.00681170e-01 -1.28296331e+00 -4.30827696e-01 -1.30754636e-01]
 [-1.73673948e-01 -5.92373012e-01  1.94384000e-01  1.32509732e-01]
 [ 5.53333275e-01  5.58610819e-01  1.27429511e+00  1.71209594e+00]
 [-5.25060772e-02 -8.22569778e-01  7.62758269e-01  9.22302838e-01]
 [ 1.52267624e+00 -1.31979479e-01  1.21745768e+00  1.18556721e+00]
 [ 5.53333275e-01 -3.62176246e-01  1.04694540e+00  7.90670654e-01]
 [ 7.95669016e-01 -1.31979479e-01  1.16062026e+00  1.31719939e+00]
 [ 2.12851559e+00 -1.31979479e-01  1.61531967e+00  1.18556721e+00]
 [-1.14301691e+00 -1.28296331e+00  4.21733708e-01  6.59038469e-01]
 [ 1.76501198e+00 -3.62176246e-01  1.44480739e+00  7.90670654e-01]
 [ 1.03800476e+00 -1.28296331e+00  1.16062026e+00  7.90670654e-01]
 [ 1.64384411e+00  1.24920112e+00  1.33113254e+00  1.71209594e+00]
 [ 7.95669016e-01  3.28414053e-01  7.62758269e-01  1.05393502e+00]
 [ 6.74501145e-01 -8.22569778e-01  8.76433123e-01  9.22302838e-01]
 [ 1.15917263e+00 -1.31979479e-01  9.90107977e-01  1.18556721e+00]
 [-1.73673948e-01 -1.28296331e+00  7.05920842e-01  1.05393502e+00]
 [-5.25060772e-02 -5.92373012e-01  7.62758269e-01  1.58046376e+00]
 [ 6.74501145e-01  3.28414053e-01  8.76433123e-01  1.44883158e+00]
 [ 7.95669016e-01 -1.31979479e-01  9.90107977e-01  7.90670654e-01]
 [ 2.24968346e+00  1.70959465e+00  1.67215710e+00  1.31719939e+00]
 [ 2.24968346e+00 -1.05276654e+00  1.78583195e+00  1.44883158e+00]
 [ 1.89829664e-01 -1.97355361e+00  7.05920842e-01  3.95774101e-01]
 [ 1.28034050e+00  3.28414053e-01  1.10378283e+00  1.44883158e+00]
 [-2.94841818e-01 -5.92373012e-01  6.49083415e-01  1.05393502e+00]
 [ 2.24968346e+00 -5.92373012e-01  1.67215710e+00  1.05393502e+00]
 [ 5.53333275e-01 -8.22569778e-01  6.49083415e-01  7.90670654e-01]
 [ 1.03800476e+00  5.58610819e-01  1.10378283e+00  1.18556721e+00]
 [ 1.64384411e+00  3.28414053e-01  1.27429511e+00  7.90670654e-01]
 [ 4.32165405e-01 -5.92373012e-01  5.92245988e-01  7.90670654e-01]
 [ 3.10997534e-01 -1.31979479e-01  6.49083415e-01  7.90670654e-01]
 [ 6.74501145e-01 -5.92373012e-01  1.04694540e+00  1.18556721e+00]
 [ 1.64384411e+00 -1.31979479e-01  1.16062026e+00  5.27406285e-01]
 [ 1.88617985e+00 -5.92373012e-01  1.33113254e+00  9.22302838e-01]
 [ 2.49201920e+00  1.70959465e+00  1.50164482e+00  1.05393502e+00]
 [ 6.74501145e-01 -5.92373012e-01  1.04694540e+00  1.31719939e+00]
 [ 5.53333275e-01 -5.92373012e-01  7.62758269e-01  3.95774101e-01]
 [ 3.10997534e-01 -1.05276654e+00  1.04694540e+00  2.64141916e-01]
 [ 2.24968346e+00 -1.31979479e-01  1.33113254e+00  1.44883158e+00]
 [ 5.53333275e-01  7.88807586e-01  1.04694540e+00  1.58046376e+00]
 [ 6.74501145e-01  9.82172869e-02  9.90107977e-01  7.90670654e-01]
 [ 1.89829664e-01 -1.31979479e-01  5.92245988e-01  7.90670654e-01]
 [ 1.28034050e+00  9.82172869e-02  9.33270550e-01  1.18556721e+00]
 [ 1.03800476e+00  9.82172869e-02  1.04694540e+00  1.58046376e+00]
 [ 1.28034050e+00  9.82172869e-02  7.62758269e-01  1.44883158e+00]
 [-5.25060772e-02 -8.22569778e-01  7.62758269e-01  9.22302838e-01]
 [ 1.15917263e+00  3.28414053e-01  1.21745768e+00  1.44883158e+00]
 [ 1.03800476e+00  5.58610819e-01  1.10378283e+00  1.71209594e+00]
 [ 1.03800476e+00 -1.31979479e-01  8.19595696e-01  1.44883158e+00]
 [ 5.53333275e-01 -1.28296331e+00  7.05920842e-01  9.22302838e-01]
 [ 7.95669016e-01 -1.31979479e-01  8.19595696e-01  1.05393502e+00]
 [ 4.32165405e-01  7.88807586e-01  9.33270550e-01  1.44883158e+00]
 [ 6.86617933e-02 -1.31979479e-01  7.62758269e-01  7.90670654e-01]]
#方法2: 区间缩放法 例3:对简单示例二维矩阵的列数据进行
from sklearn.preprocessing import MinMaxScaler

data = [[0, 0], 
        [0, 0], 
        [100, 1], 
        [1, 1]]

scaler = MinMaxScaler()
print(scaler.fit(data))
print(scaler.transform(data))
MinMaxScaler(copy=True, feature_range=(0, 1))
[[0.   0.  ]
 [0.   0.  ]
 [1.   1.  ]
 [0.01 1.  ]]
#方法2: 区间缩放法 例4:对iris数据二维矩阵的列数据进行
from sklearn.preprocessing import MinMaxScaler

data = iris.data

scaler = MinMaxScaler()
print(scaler.fit(data))
print(scaler.transform(data))
MinMaxScaler(copy=True, feature_range=(0, 1))
[[0.22222222 0.625      0.06779661 0.04166667]
 [0.16666667 0.41666667 0.06779661 0.04166667]
 [0.11111111 0.5        0.05084746 0.04166667]
 [0.08333333 0.45833333 0.08474576 0.04166667]
 [0.19444444 0.66666667 0.06779661 0.04166667]
 [0.30555556 0.79166667 0.11864407 0.125     ]
 [0.08333333 0.58333333 0.06779661 0.08333333]
 [0.19444444 0.58333333 0.08474576 0.04166667]
 [0.02777778 0.375      0.06779661 0.04166667]
 [0.16666667 0.45833333 0.08474576 0.        ]
 [0.30555556 0.70833333 0.08474576 0.04166667]
 [0.13888889 0.58333333 0.10169492 0.04166667]
 [0.13888889 0.41666667 0.06779661 0.        ]
 [0.         0.41666667 0.01694915 0.        ]
 [0.41666667 0.83333333 0.03389831 0.04166667]
 [0.38888889 1.         0.08474576 0.125     ]
 [0.30555556 0.79166667 0.05084746 0.125     ]
 [0.22222222 0.625      0.06779661 0.08333333]
 [0.38888889 0.75       0.11864407 0.08333333]
 [0.22222222 0.75       0.08474576 0.08333333]
 [0.30555556 0.58333333 0.11864407 0.04166667]
 [0.22222222 0.70833333 0.08474576 0.125     ]
 [0.08333333 0.66666667 0.         0.04166667]
 [0.22222222 0.54166667 0.11864407 0.16666667]
 [0.13888889 0.58333333 0.15254237 0.04166667]
 [0.19444444 0.41666667 0.10169492 0.04166667]
 [0.19444444 0.58333333 0.10169492 0.125     ]
 [0.25       0.625      0.08474576 0.04166667]
 [0.25       0.58333333 0.06779661 0.04166667]
 [0.11111111 0.5        0.10169492 0.04166667]
 [0.13888889 0.45833333 0.10169492 0.04166667]
 [0.30555556 0.58333333 0.08474576 0.125     ]
 [0.25       0.875      0.08474576 0.        ]
 [0.33333333 0.91666667 0.06779661 0.04166667]
 [0.16666667 0.45833333 0.08474576 0.04166667]
 [0.19444444 0.5        0.03389831 0.04166667]
 [0.33333333 0.625      0.05084746 0.04166667]
 [0.16666667 0.66666667 0.06779661 0.        ]
 [0.02777778 0.41666667 0.05084746 0.04166667]
 [0.22222222 0.58333333 0.08474576 0.04166667]
 [0.19444444 0.625      0.05084746 0.08333333]
 [0.05555556 0.125      0.05084746 0.08333333]
 [0.02777778 0.5        0.05084746 0.04166667]
 [0.19444444 0.625      0.10169492 0.20833333]
 [0.22222222 0.75       0.15254237 0.125     ]
 [0.13888889 0.41666667 0.06779661 0.08333333]
 [0.22222222 0.75       0.10169492 0.04166667]
 [0.08333333 0.5        0.06779661 0.04166667]
 [0.27777778 0.70833333 0.08474576 0.04166667]
 [0.19444444 0.54166667 0.06779661 0.04166667]
 [0.75       0.5        0.62711864 0.54166667]
 [0.58333333 0.5        0.59322034 0.58333333]
 [0.72222222 0.45833333 0.66101695 0.58333333]
 [0.33333333 0.125      0.50847458 0.5       ]
 [0.61111111 0.33333333 0.61016949 0.58333333]
 [0.38888889 0.33333333 0.59322034 0.5       ]
 [0.55555556 0.54166667 0.62711864 0.625     ]
 [0.16666667 0.16666667 0.38983051 0.375     ]
 [0.63888889 0.375      0.61016949 0.5       ]
 [0.25       0.29166667 0.49152542 0.54166667]
 [0.19444444 0.         0.42372881 0.375     ]
 [0.44444444 0.41666667 0.54237288 0.58333333]
 [0.47222222 0.08333333 0.50847458 0.375     ]
 [0.5        0.375      0.62711864 0.54166667]
 [0.36111111 0.375      0.44067797 0.5       ]
 [0.66666667 0.45833333 0.57627119 0.54166667]
 [0.36111111 0.41666667 0.59322034 0.58333333]
 [0.41666667 0.29166667 0.52542373 0.375     ]
 [0.52777778 0.08333333 0.59322034 0.58333333]
 [0.36111111 0.20833333 0.49152542 0.41666667]
 [0.44444444 0.5        0.6440678  0.70833333]
 [0.5        0.33333333 0.50847458 0.5       ]
 [0.55555556 0.20833333 0.66101695 0.58333333]
 [0.5        0.33333333 0.62711864 0.45833333]
 [0.58333333 0.375      0.55932203 0.5       ]
 [0.63888889 0.41666667 0.57627119 0.54166667]
 [0.69444444 0.33333333 0.6440678  0.54166667]
 [0.66666667 0.41666667 0.6779661  0.66666667]
 [0.47222222 0.375      0.59322034 0.58333333]
 [0.38888889 0.25       0.42372881 0.375     ]
 [0.33333333 0.16666667 0.47457627 0.41666667]
 [0.33333333 0.16666667 0.45762712 0.375     ]
 [0.41666667 0.29166667 0.49152542 0.45833333]
 [0.47222222 0.29166667 0.69491525 0.625     ]
 [0.30555556 0.41666667 0.59322034 0.58333333]
 [0.47222222 0.58333333 0.59322034 0.625     ]
 [0.66666667 0.45833333 0.62711864 0.58333333]
 [0.55555556 0.125      0.57627119 0.5       ]
 [0.36111111 0.41666667 0.52542373 0.5       ]
 [0.33333333 0.20833333 0.50847458 0.5       ]
 [0.33333333 0.25       0.57627119 0.45833333]
 [0.5        0.41666667 0.61016949 0.54166667]
 [0.41666667 0.25       0.50847458 0.45833333]
 [0.19444444 0.125      0.38983051 0.375     ]
 [0.36111111 0.29166667 0.54237288 0.5       ]
 [0.38888889 0.41666667 0.54237288 0.45833333]
 [0.38888889 0.375      0.54237288 0.5       ]
 [0.52777778 0.375      0.55932203 0.5       ]
 [0.22222222 0.20833333 0.33898305 0.41666667]
 [0.38888889 0.33333333 0.52542373 0.5       ]
 [0.55555556 0.54166667 0.84745763 1.        ]
 [0.41666667 0.29166667 0.69491525 0.75      ]
 [0.77777778 0.41666667 0.83050847 0.83333333]
 [0.55555556 0.375      0.77966102 0.70833333]
 [0.61111111 0.41666667 0.81355932 0.875     ]
 [0.91666667 0.41666667 0.94915254 0.83333333]
 [0.16666667 0.20833333 0.59322034 0.66666667]
 [0.83333333 0.375      0.89830508 0.70833333]
 [0.66666667 0.20833333 0.81355932 0.70833333]
 [0.80555556 0.66666667 0.86440678 1.        ]
 [0.61111111 0.5        0.69491525 0.79166667]
 [0.58333333 0.29166667 0.72881356 0.75      ]
 [0.69444444 0.41666667 0.76271186 0.83333333]
 [0.38888889 0.20833333 0.6779661  0.79166667]
 [0.41666667 0.33333333 0.69491525 0.95833333]
 [0.58333333 0.5        0.72881356 0.91666667]
 [0.61111111 0.41666667 0.76271186 0.70833333]
 [0.94444444 0.75       0.96610169 0.875     ]
 [0.94444444 0.25       1.         0.91666667]
 [0.47222222 0.08333333 0.6779661  0.58333333]
 [0.72222222 0.5        0.79661017 0.91666667]
 [0.36111111 0.33333333 0.66101695 0.79166667]
 [0.94444444 0.33333333 0.96610169 0.79166667]
 [0.55555556 0.29166667 0.66101695 0.70833333]
 [0.66666667 0.54166667 0.79661017 0.83333333]
 [0.80555556 0.5        0.84745763 0.70833333]
 [0.52777778 0.33333333 0.6440678  0.70833333]
 [0.5        0.41666667 0.66101695 0.70833333]
 [0.58333333 0.33333333 0.77966102 0.83333333]
 [0.80555556 0.41666667 0.81355932 0.625     ]
 [0.86111111 0.33333333 0.86440678 0.75      ]
 [1.         0.75       0.91525424 0.79166667]
 [0.58333333 0.33333333 0.77966102 0.875     ]
 [0.55555556 0.33333333 0.69491525 0.58333333]
 [0.5        0.25       0.77966102 0.54166667]
 [0.94444444 0.41666667 0.86440678 0.91666667]
 [0.55555556 0.58333333 0.77966102 0.95833333]
 [0.58333333 0.45833333 0.76271186 0.70833333]
 [0.47222222 0.41666667 0.6440678  0.70833333]
 [0.72222222 0.45833333 0.74576271 0.83333333]
 [0.66666667 0.45833333 0.77966102 0.95833333]
 [0.72222222 0.45833333 0.69491525 0.91666667]
 [0.41666667 0.29166667 0.69491525 0.75      ]
 [0.69444444 0.5        0.83050847 0.91666667]
 [0.66666667 0.54166667 0.79661017 1.        ]
 [0.66666667 0.41666667 0.71186441 0.91666667]
 [0.55555556 0.20833333 0.6779661  0.75      ]
 [0.61111111 0.41666667 0.71186441 0.79166667]
 [0.52777778 0.58333333 0.74576271 0.91666667]
 [0.44444444 0.41666667 0.69491525 0.70833333]]

                   

这篇关于使用sklearn进行量纲缩放的程序的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程