Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils.multiclass`.is_multilabel

sklearn.utils.multiclass.is_multilabel(y)

  Check if `y` is in a multilabel format.

  Parameters:
    y ndarray 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