[Self-use] sklearn feature scaling MinMaxScaler

Feature scaling - used to normalize the range of data features.
Let's scale the feature between 0.0 and 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: For personal use without explanation Author: A handsome pot    

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325148620&siteId=291194637