Skip to content

Commit 255895d

Browse files
jnothmanogrisel
authored andcommitted
DOC remove mention of sequence of sequences in Parameters sections
1 parent 8ce9077 commit 255895d

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

doc/modules/multiclass.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ Multilabel learning
139139
-------------------
140140

141141
:class:`OneVsRestClassifier` also supports multilabel classification.
142-
To use this feature, feed the classifier a list of tuples containing
143-
target labels, like in the example below.
142+
To use this feature, feed the classifier an indicator matrix, in which cell
143+
[i, j] indicates the presence of label j in sample i.
144144

145145

146146
.. figure:: ../auto_examples/images/plot_multilabel_1.png

sklearn/metrics/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def _check_clf_targets(y_true, y_pred):
101101
The type of the true target data, as output by
102102
``utils.multiclass.type_of_target``
103103
104-
y_true : array or indicator matrix or sequence of sequences
104+
y_true : array or indicator matrix
105105
106-
y_pred : array or indicator matrix or sequence of sequences
106+
y_pred : array or indicator matrix
107107
"""
108108
y_true, y_pred = check_arrays(y_true, y_pred, allow_lists=True)
109109
type_true = type_of_target(y_true)

sklearn/multiclass.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ class OneVsRestClassifier(BaseEstimator, ClassifierMixin, MetaEstimatorMixin):
142142
multiclass classification and is a fair default choice.
143143
144144
This strategy can also be used for multilabel learning, where a classifier
145-
is used to predict multiple labels for instance, by fitting on a sequence
146-
of sequences of labels (e.g., a list of tuples) rather than a single
147-
target vector. For multilabel learning, the number of classes must be at
145+
is used to predict multiple labels for instance, by fitting on a 2-d matrix
146+
in which cell [i, j] is 1 sample i has label j and 0 otherwise.
147+
For multilabel learning, the number of classes must be at
148148
least three, since otherwise OvR reduces to binary classification.
149149
150150
In the multilabel learning literature, OvR is also known as the binary
@@ -188,9 +188,8 @@ def fit(self, X, y):
188188
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
189189
Data.
190190
191-
y : array-like, shape = [n_samples]
192-
or sequence of sequences, len = n_samples
193-
Multi-class targets. A sequence of sequences turns on multilabel
191+
y : array-like, shape = [n_samples] or [n_samples, n_classes]
192+
Multi-class targets. An indicator matrix turns on multilabel
194193
classification.
195194
196195
Returns

sklearn/preprocessing/label.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ def fit(self, y):
248248
249249
Parameters
250250
----------
251-
y : numpy array of shape (n_samples,) or sequence of sequences
252-
Target values. In the multilabel case the nested sequences can
253-
have variable lengths.
251+
y : numpy array of shape (n_samples,) or (n_samples, n_classes)
252+
Target values. The 2-d matrix should only contain 0 and 1,
253+
represents multilabel classification, and is returned unchanged
254+
by LabelBinarizer.
254255
255256
Returns
256257
-------
@@ -273,9 +274,10 @@ def transform(self, y):
273274
274275
Parameters
275276
----------
276-
y : numpy array of shape [n_samples] or sequence of sequences
277-
Target values. In the multilabel case the nested sequences can
278-
have variable lengths.
277+
y : numpy array of shape (n_samples,) or (n_samples, n_classes)
278+
Target values. The 2-d matrix should only contain 0 and 1,
279+
represents multilabel classification, and is returned unchanged
280+
by LabelBinarizer.
279281
280282
Returns
281283
-------
@@ -315,9 +317,10 @@ def inverse_transform(self, Y, threshold=None):
315317
316318
Returns
317319
-------
318-
y : numpy array of shape [n_samples] or sequence of sequences
319-
Target values. In the multilabel case the nested sequences can
320-
have variable lengths.
320+
y : numpy array of shape (n_samples,) or (n_samples, n_classes)
321+
Target values. The 2-d matrix should only contain 0 and 1,
322+
represents multilabel classification, and is returned unchanged
323+
by LabelBinarizer.
321324
322325
Notes
323326
-----

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy