October 2018
Intermediate to advanced
172 pages
4h 6m
English
In this section, you will learn about how scaling and standardizing the data can lead to an improvement in the overall performance of the linear support vector machines. The concept of scaling remains the same as in the case of the previous chapters, and it will not be discussed here. In order to scale the data, we use the following code:
from sklearn.preprocessing import StandardScalerfrom sklearn.pipeline import Pipeline#Setting up the scaling pipeline order = [('scaler', StandardScaler()), ('SVM', LinearSVC(C = 0.1, random_state = 50))]pipeline = Pipeline(order)#Fitting the classfier to the scaled dataset svm_scaled = pipeline.fit(X_train, y_train)#Extracting the score svm_scaled.score(X_test, ...Read now
Unlock full access