December 2019
Intermediate to advanced
368 pages
11h 10m
English
Scaling inputs to fit into a specific range is another method of data preprocessing. This method is an alternative to standardization. Range scaling produces data samples that lie within a given range between the minimum and maximum values. Often, this method is used to scale input data in a range between zero and one. You can use MinMaxScaler of the Scikit-learn Python library to scale data in a range, as shown in the following example:
>>> import sklearn.preprocessing>>> X_train = np.array([[ 1., -1., 2.],... [ 2., 0., 0.],... [ 0., 1., -1.]])...>>> min_max_scaler = preprocessing.MinMaxScaler()>>> X_train_minmax = min_max_scaler.fit_transform(X_train)>>> X_train_minmaxarray([[0.5 , 0. , 1. ], [1. , 0.5 , 0.33333333], ...
Read now
Unlock full access