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

24,383

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.

Share:
24,383
log0
Author by

log0

Updated on August 22, 2020

Comments

  • log0
    log0 over 3 years

    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.