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
, ify
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