How to obtain the training error in svm of Scikit-learn?

machine-learning, python, scikit-learn, svm

Solution

Just compute the score on the training data:

>>> model.fit(X_train, y_train).score(X_train, y_train)

You can also use any other performance metrics from the `sklearn.metrics` module. The doc is here:

http://scikit-learn.org/stable/modules/model_evaluation.html

Also: `oob_score_` is an estimate of the test / validation score, not the training score.

Problem

My question: How do I obtain the training error in the svm module (SVC class)? I am trying to do a plot of error of the train set and test set against the number of training data used ( or other features such as C / gamma ). However, according to the SVM documentation , there is no such exposed attribute or method to return such data. I did find that RandomForestClassifier does expose a oob_score_ though.

Original source