Scaling the features

For many machine learning algorithms, it's good practice to scale the variables from 0 to 1. This is also called feature normalization. Let's apply the scaling transformation to achieve this:

from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

After we scale the data, it is ready to be used as input to the different classifiers that we will present in the subsequent sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.1.239