June 2020
Intermediate to advanced
382 pages
11h 39m
English
First, let's instantiate the SVM classifier and then use the training portion of the labeled data to train it. The kernel hyperparameter determines the type of transformation that is applied to the input data in order to make it linearly separable.:
from sklearn.svm import SVCclassifier = SVC(kernel = 'linear', random_state = 0)classifier.fit(X_train, y_train)
Once trained, let's generate some predictions and look at the confusion matrix:
y_pred = classifier.predict(X_test)cm = metrics.confusion_matrix(y_test, y_pred)cm
Observe the following output:
Now, let's look at the various ...