W3cubDocs

/scikit-learn

sklearn.utils.multiclass.is_multilabel

sklearn.utils.multiclass.is_multilabel(y) [source]

Check if y is in a multilabel format.

Parameters:
y : numpy array of shape [n_samples]

Target values.

Returns:
out : bool,

Return True, if y is in a multilabel format, else `False.

Examples

>>> import numpy as np
>>> from sklearn.utils.multiclass import is_multilabel
>>> is_multilabel([0, 1, 0, 1])
False
>>> is_multilabel([[1], [0, 2], []])
False
>>> is_multilabel(np.array([[1, 0], [0, 0]]))
True
>>> is_multilabel(np.array([[1], [0], [0]]))
False
>>> is_multilabel(np.array([[1, 0, 0]]))
True

© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.utils.multiclass.is_multilabel.html