How to plot model accuracy and loss for cross-validation with SVM classifier?

Viewed 290

Greeting of the day.

I used SVM classifier to classify clickbaits and non-clickbaits.

The code is:

// code for training SVM with cross validation
svm_class = svm.SVC(kernel='linear', C = 1.0)
result_svm= cross_val_score(svm_class, x,encoded_Y, scoring='accuracy', cv = 10)
print("Accuracy with SVM")
result_svm.mean()*100

Ouptut: 94.30 %

// code for cross-validation test
y_pred_svm=cross_val_predict(svm_class,x,encoded_Y,cv=10)

//code for confusion matrix
import numpy as np
y_s=np.argmax(y, axis=1)
#print(y_s)
from sklearn.metrics import confusion_matrix
cm_svm = confusion_matrix(y_s, y_pred_svm)
cm_svm
 Output:  array([[3688,  312],
        [ 257, 5743]])

I got two quesitons:

First, how do I plot model accuracy and loss for this SVM?

Second, how do I plot the ROC-AUC curve?

0 Answers
Related