8000 DOC Adds example to OneVsRestClassifier by veerlosar · Pull Request #15201 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC Adds example to OneVsRestClassifier #15201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions sklearn/multiclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0