def is_multilabel(y):
 if hasattr(y, '__array__'):
  y = np.asarray(y)
 if (not (hasattr(y, 'shape') and (y.ndim == 2) and (y.shape[1] > 1))):
  return False
 if issparse(y):
  if isinstance(y, (dok_matrix, lil_matrix)):
   y = y.tocsr()
  return ((len(y.data) == 0) or ((np.unique(y.data).size == 1) and ((y.dtype.kind in 'biu') or _is_integral_float(np.unique(y.data)))))
 else:
  labels = np.unique(y)
  return ((len(labels) < 3) and ((y.dtype.kind in 'biu') or _is_integral_float(labels)))

def is_multilabel ( y ) : if hasattr ( y , '__array__' ) : y = np . asarray ( y ) if ( not ( hasattr ( y , 'shape' ) and ( y . ndim == 2 ) and ( y . shape [ 1 ] > 1 ) ) ) : return False if issparse ( y ) : if isinstance ( y , ( dok_matrix , lil_matrix ) ) : y = y . tocsr ( ) return ( ( len ( y . data ) == 0 ) or ( ( np . unique ( y . data ) . size == 1 ) and ( ( y . dtype . kind in 'biu' ) or _is_integral_float ( np . unique ( y . data ) ) ) ) ) else : labels = np . unique ( y ) return ( ( len ( labels ) < 3 ) and ( ( y . dtype . kind in 'biu' ) or _is_integral_float ( labels ) ) )
check if y is in a multilabel format .