August 2019
Intermediate to advanced
342 pages
9h 35m
English
The following example shows the StandardScaler class of scikit-learn in action, used to compute the mean and standard deviation on a training set by leveraging the transform() method:
from sklearn import preprocessingimport numpy as npraw_data = np.array([[ 2., -3., 4.],[ 5., 0., 1.],[ 4., 0., -2.]])std_scaler = preprocessing.StandardScaler().fit(raw_data)std_scaler.transform(raw_data)test_data = [[-3., 1., 2.]]std_scaler.transform(test_data)
Read now
Unlock full access