is_multilabel#

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

Check if y is in a multilabel format.

Parameters:
yndarray of shape (n_samples,)

Target values.

Returns:
outbool

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