DOC add an example in docstring of OneVsOneClassifier
@@ -523,6 +523,20 @@ class OneVsOneClassifier(MetaEstimatorMixin, ClassifierMixin, BaseEstimator):
pairwise_indices_ : list, length = ``len(estimators_)``, or ``None``
Indices of samples used when training the estimators.
``None`` when ``estimator`` does not have ``_pairwise`` attribute.
+
+ Examples
+ --------
+ >>> from sklearn.datasets import load_iris
+ >>> from sklearn.model_selection import train_test_split
+ >>> from sklearn.multiclass import OneVsOneClassifier
+ >>> from sklearn.svm import LinearSVC
+ >>> X, y = load_iris(return_X_y=True)
+ >>> X_train, X_test, y_train, y_test = train_test_split(
+ ... X, y, test_size=0.33, shuffle=True, random_state=0)
+ >>> clf = OneVsOneClassifier(
+ ... LinearSVC(random_state=0)).fit(X_train, y_train)
+ >>> clf.predict(X_test[:10])
+ array([2, 1, 0, 2, 0, 2, 0, 1, 1, 1])
"""
@_deprecate_positional_args
def __init__(self, estimator, *, n_jobs=None):
