# How to plot train test error for classification models like Support Vector Classification(SVC)

How to plot train test error for classification models like Support Vector Classification(SVC). I am using SVC from sklearn module, not able to get train and test errors to plot

## 1 Answer

Well you haven't defined what "error" means, so I'll just assume that you want the log loss.

First, you need to create your SVC object telling it you'll want probability estimations:

model = sklearn.svm.SVC(probability=True)


Then you can compute the log loss given said estimation:

probs = model.predict_proba(x)
loss = sklearn.metrics.log_loss(y_true=y, y_pred=probs)

• Thanks! BUt i want to plot mean_train_score and mean_test_score values in GridSearchCV for C and gamma values of SVM. How can i do that? – Harika M Sep 21 '18 at 22:50
• You can use the scoring parameter in GridSearchCV – Fred Sep 22 '18 at 23:09