parameters: (y)
docstring: Determine the type of data indicated by target `y`
  
      Parameters
      ----------
      y : array-like
  
      Returns
      -------
      target_type : string
          One of:
          * 'continuous': `y` is an array-like of floats that are not all
            integers, and is 1d or a column vector.
          * 'continuous-multioutput': `y` is a 2d array of floats that are
            not all integers, and both dimensions are of size > 1.
          * 'binary': `y` contains <= 2 discrete values and is 1d or a column
            vector.
          * 'multiclass': `y` contains more than two discrete values, is not a
            sequence of sequences, and is 1d or a column vector.
          * 'multiclass-multioutput': `y` is a 2d array that contains more
            than two discrete values, is not a sequence of sequences, and both
            dimensions are of size > 1.
          * 'multilabel-indicator': `y` is a label indicator matrix, an array
            of two dimensions with at least two columns, and at most 2 unique
            values.
          * 'unknown': `y` is array-like but none of the above, such as a 3d
            array, sequence of sequences, or an array of non-sequence objects.
  
      Examples
      --------
      >>> import numpy as np
      >>> type_of_target([0.1, 0.6])
      'continuous'
      >>> type_of_target([1, -1, -1, 1])
      'binary'
      >>> type_of_target(['a', 'b', 'a'])
      'binary'
      >>> type_of_target([1.0, 2.0])
      'binary'
      >>> type_of_target([1, 0, 2])
      'multiclass'
      >>> type_of_target([1.0, 0.0, 3.0])
      'multiclass'
      >>> type_of_target(['a', 'b', 'c'])
      'multiclass'
      >>> type_of_target(np.array([[1, 2], [3, 1]]))
      'multiclass-multioutput'
      >>> type_of_target([[1, 2]])
      'multiclass-multioutput'
      >>> type_of_target(np.array([[1.5, 2.0], [3.0, 1.6]]))
      'continuous-multioutput'
      >>> type_of_target(np.array([[0, 1], [1, 1]]))
      'multilabel-indicator'
docstring_summary: Determine the type of data indicated by target `y`
docstring_tokens: Determine the type of data indicated by target y
function: def type_of_target(y):
      """Determine the type of data indicated by target `y`
  
      Parameters
      ----------
      y : array-like
  
      Returns
      -------
      target_type : string
          One of:
          * 'continuous': `y` is an array-like of floats that are not all
            integers, and is 1d or a column vector.
          * 'continuous-multioutput': `y` is a 2d array of floats that are
            not all integers, and both dimensions are of size > 1.
          * 'binary': `y` contains <= 2 discrete values and is 1d or a column
            vector.
          * 'multiclass': `y` contains more than two discrete values, is not a
            sequence of sequences, and is 1d or a column vector.
          * 'multiclass-multioutput': `y` is a 2d array that contains more
            than two discrete values, is not a sequence of sequences, and both
            dimensions are of size > 1.
          * 'multilabel-indicator': `y` is a label indicator matrix, an array
            of two dimensions with at least two columns, and at most 2 unique
            values.
          * 'unknown': `y` is array-like but none of the above, such as a 3d
            array, sequence of sequences, or an array of non-sequence objects.
  
      Examples
      --------
      >>> import numpy as np
      >>> type_of_target([0.1, 0.6])
      'continuous'
      >>> type_of_target([1, -1, -1, 1])
      'binary'
      >>> type_of_target(['a', 'b', 'a'])
      'binary'
      >>> type_of_target([1.0, 2.0])
      'binary'
      >>> type_of_target([1, 0, 2])
      'multiclass'
      >>> type_of_target([1.0, 0.0, 3.0])
      'multiclass'
      >>> type_of_target(['a', 'b', 'c'])
      'multiclass'
      >>> type_of_target(np.array([[1, 2], [3, 1]]))
      'multiclass-multioutput'
      >>> type_of_target([[1, 2]])
      'multiclass-multioutput'
      >>> type_of_target(np.array([[1.5, 2.0], [3.0, 1.6]]))
      'continuous-multioutput'
      >>> type_of_target(np.array([[0, 1], [1, 1]]))
      'multilabel-indicator'
      """
      valid = ((isinstance(y, (Sequence, spmatrix)) or hasattr(y, '__array__'))
               and not isinstance(y, string_types))
  
      if not valid:
          raise ValueError('Expected array-like (array or non-string sequence), '
                           'got %r' % y)
  
      if is_multilabel(y):
          return 'multilabel-indicator'
  
      try:
          y = np.asarray(y)
      except ValueError:
          # Known to fail in numpy 1.3 for array of arrays
          return 'unknown'
  
      # The old sequence of sequences format
      try:
          if (not hasattr(y[0], '__array__') and isinstance(y[0], Sequence)
                  and not isinstance(y[0], string_types)):
              raise ValueError('You appear to be using a legacy multi-label data'
                               ' representation. Sequence of sequences are no'
                               ' longer supported; use a binary array or sparse'
                               ' matrix instead.')
      except IndexError:
          pass
  
      # Invalid inputs
      if y.ndim > 2 or (y.dtype == object and len(y) and
                        not isinstance(y.flat[0], string_types)):
          return 'unknown'  # [[[1, 2]]] or [obj_1] and not ["label_1"]
  
      if y.ndim == 2 and y.shape[1] == 0:
          return 'unknown'  # [[]]
  
      if y.ndim == 2 and y.shape[1] > 1:
          suffix = "-multioutput"  # [[1, 2], [1, 2]]
      else:
          suffix = ""  # [1, 2, 3] or [[1], [2], [3]]
  
      # check float and contains non-integer float values
      if y.dtype.kind == 'f' and np.any(y != y.astype(int)):
          # [.1, .2, 3] or [[.1, .2, 3]] or [[1., .2]] and not [1., 2., 3.]
          return 'continuous' + suffix
  
      if (len(np.unique(y)) > 2) or (y.ndim >= 2 and len(y[0]) > 1):
          return 'multiclass' + suffix  # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]]
      else:
          return 'binary'
function_tokens: def type_of_target ( y ) : valid = ( ( isinstance ( y , ( Sequence , spmatrix ) ) or hasattr ( y , '__array__' ) ) and not isinstance ( y , string_types ) ) if not valid : raise ValueError ( 'Expected array-like (array or non-string sequence), ' 'got %r' % y ) if is_multilabel ( y ) : return 'multilabel-indicator' try : y = np . asarray ( y ) except ValueError : # Known to fail in numpy 1.3 for array of arrays return 'unknown' # The old sequence of sequences format try : if ( not hasattr ( y [ 0 ] , '__array__' ) and isinstance ( y [ 0 ] , Sequence ) and not isinstance ( y [ 0 ] , string_types ) ) : raise ValueError ( 'You appear to be using a legacy multi-label data' ' representation. Sequence of sequences are no' ' longer supported; use a binary array or sparse' ' matrix instead.' ) except IndexError : pass # Invalid inputs if y . ndim > 2 or ( y . dtype == object and len ( y ) and not isinstance ( y . flat [ 0 ] , string_types ) ) : return 'unknown' # [[[1, 2]]] or [obj_1] and not ["label_1"] if y . ndim == 2 and y . shape [ 1 ] == 0 : return 'unknown' # [[]] if y . ndim == 2 and y . shape [ 1 ] > 1 : suffix = "-multioutput" # [[1, 2], [1, 2]] else : suffix = "" # [1, 2, 3] or [[1], [2], [3]] # check float and contains non-integer float values if y . dtype . kind == 'f' and np . any ( y != y . astype ( int ) ) : # [.1, .2, 3] or [[.1, .2, 3]] or [[1., .2]] and not [1., 2., 3.] return 'continuous' + suffix if ( len ( np . unique ( y ) ) > 2 ) or ( y . ndim >= 2 and len ( y [ 0 ] ) > 1 ) : return 'multiclass' + suffix # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]] else : return 'binary'