python minmaxscaler 28 29

Solutions on MaxInterview for python minmaxscaler 28 29 by the best coders in the world

showing results for - "python minmaxscaler 28 29"
Aidan
26 Apr 2017
1from sklearn.preprocessing import MinMaxScaler
2
3#Normal minmaxscaler function to standarise data.
4data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
5scaler = MinMaxScaler()
6scaler.fit(data)    
7
8#get data for Max and Min from scaler functions, 
9#best to store it in a dictionary and use it later make data normal again
10print(scaler.transform([[2, 2]]))
11Out>>> [[ 1.5  0. ]]
12
13# Inverse transform the the 0-1 dataframe.
14print(scaler.inverse_transform([[ 1.5  0. ]]))
15Out>>> [[ 2.0  2.0]]
16