【自用】sklearn 特征缩放 MinMaxScaler

特征缩放 —— 用来标准化数据特征的范围。
我们来把特征缩放为 0.0 1.0 之间。

from sklearn.preprocessing import MinMaxScaler
import numpy as np


def featureScaling(arr):
    scaler = MinMaxScaler()
    result = scaler.fit_transform(arr)
    return result


# tests of your feature scaler--line below is input data
data = np.array([[640.], [1440.], [1920.]])
print(featureScaling(data))

    PS:自用的  不做解释                        作者:一个吃货帅锅    

猜你喜欢

转载自my.oschina.net/kilosnow/blog/1619161
今日推荐