gerald
gerald

Reputation: 13

sci-kit SVM multi-class classification with unseen label

is there any possibility to configure an svm classifier from sci-kit such that:

1.) the svm classifier is trained with examples from 0,...,n - 1

2.) If none of the single classifiers (one-vs-rest) delivers a positive result (class membership), then the output is a designated label n which means "none of them"

Thanks!

Upvotes: 1

Views: 372

Answers (1)

eickenberg
eickenberg

Reputation: 14377

By construction, the OvR multiclass wrapper sklearn.multiclass.OneVsRestClassifier selects the maximum decision_function output or the maximum predict_proba to be decisive of predicted class. This means that there will always be a predicted class.

If you wanted e.g. to predict "None of these" when decision_function / predict_proba all stay under a certain threshold (for all OvR problems), then you would have to write this estimator yourself, but could get inspiration from the code of sklearn.multiclass.OneVsRestClassifier and just modify the decision logic.

Upvotes: 1

Related Questions