DOC Adds example to OneVsRestClassifier
@@ -181,6 +181,22 @@ class OneVsRestClassifier(MultiOutputMixin, ClassifierMixin,
multilabel_ : boolean
Whether a OneVsRestClassifier is a multilabel classifier.
+ >>> import numpy as np
+ >>> from sklearn.multiclass import OneVsRestClassifier
+ >>> from sklearn.svm import SVC
+ >>> X = np.array([
+ ... [10, 10],
+ ... [8, 10],
+ ... [-5, 5.5],
+ ... [-5.4, 5.5],
+ ... [-20, -20],
+ ... [-15, -20]
+ ... ])
+ >>> y = np.array([0, 0, 1, 1, 2, 2])
+ >>> clf = OneVsRestClassifier(SVC()).fit(X, y)
+ >>> clf.predict([[-19, -20], [9, 9], [-5, 5]])
+ array([2, 0, 1])
+
"""
def __init__(self, estimator, n_jobs=None):
self.estimator = estimator
