class_docstr: Transformer to transform indicator-based labels into categorical ones.
  
  Attributes
  ----------
  single_column_if_binary : boolean (optional, default: False)
      If true, generate a single column for binary classification case.
      Otherwise, will generate 2.
      If there are more than 2 labels, thie option will not change anything.
  forward_match : dict
      A dictionary that maps each element that occurs in the label vector
      on a index {y_i : i} with i in [0, C - 1], C the total number of
      unique labels and y_i the ith unique label.
  backward_match : array-like
      An array that maps an index back to the original label. Where
      backward_match[i] results in y_i.
  
  Examples
  --------
  >>> y = numpy.array([-1, 2, 1, 1, 2])
  >>> lc = LabelCategorizer()
  >>> lc.fit_transform(y)
  array([[1., 0., 0.],
         [0., 0., 1.],
         [0., 1., 0.],
         [0., 1., 0.],
         [0., 0., 1.]])
  >>> lc.inverse_transform([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
  array([ 1.,  2., -1.])
  >>> y = numpy.array([-1, 2, -1, -1, 2])
  >>> lc = LabelCategorizer(single_column_if_binary=True)
  >>> lc.fit_transform(y)
  array([[1.],
         [0.],
         [1.],
         [1.],
         [0.]])
  >>> lc.inverse_transform(lc.transform(y))
  array([-1.,  2., -1., -1.,  2.])
  
  References
  ----------
  .. [1] J. Grabocka et al. Learning Time-Series Shapelets. SIGKDD 2014.
class_docstr_tok: ["Transformer","to","transform","indicator-based","labels","into","categorical","ones",".","Attributes","--","--","--","--","--","single_column_if_binary",":","boolean","(","optional",",","default",":","False",")","If","true",",","generate","a","single","column","for","binary","classification","case",".","Otherwise",",","will","generate","2",".","If","there","are","more","than","2","labels",",","thie","option","will","not","change","anything",".","forward_match",":","dict","A","dictionary","that","maps","each","element","that","occurs","in","the","label","vector","on","a","index","{","y_i",":","i","}","with","i","in","[","0",",","C","-","1","]",",","C","the","total","number","of","unique","labels","and","y_i","the","ith","unique","label",".","backward_match",":","array-like","An","array","that","maps","an","index","back","to","the","original","label",".","Where","backward_match","[","i","]","results","in","y_i",".","Examples","--","--","--","--",">",">",">","y","=","numpy.array","(","[","-1",",","2",",","1",",","1",",","2","]",")",">",">",">","lc","=","LabelCategorizer","(",")",">",">",">","lc.fit_transform","(","y",")","array","(","[","[","1.",",","0.",",","0",".","]",",","[","0.",",","0.",",","1",".","]",",","[","0.",",","1.",",","0",".","]",",","[","0.",",","1.",",","0",".","]",",","[","0.",",","0.",",","1",".","]","]",")",">",">",">","lc.inverse_transform","(","[","[","0",",","1",",","0","]",",","[","0",",","0",",","1","]",",","[","1",",","0",",","0","]","]",")","array","(","[","1.",",","2.",",","-1",".","]",")",">",">",">","y","=","numpy.array","(","[","-1",",","2",",","-1",",","-1",",","2","]",")",">",">",">","lc","=","LabelCategorizer","(","single_column_if_binary=True",")",">",">",">","lc.fit_transform","(","y",")","array","(","[","[","1",".","]",",","[","0",".","]",",","[","1",".","]",",","[","1",".","]",",","[","0",".","]","]",")",">",">",">","lc.inverse_transform","(","lc.transform","(","y",")",")","array","(","[","-1.",",","2.",",","-1.",",","-1.",",","2",".","]",")","References","--","--","--","--","--","..","[","1","]","J.","Grabocka","et","al",".","Learning","Time-Series","Shapelets",".","SIGKDD","2014","."]
code: def transform(self, y):
      check_is_fitted(self, ["backward_match", "forward_match"])
      y = column_or_1d(y, warn=True)
      n_classes = len(self.backward_match)
      n = len(y)
      y_out = numpy.zeros((n, n_classes))
      for i in range(n):
          y_out[i, self.forward_match[y[i]]] = 1
      if n_classes == 2 and self.single_column_if_binary:
          return y_out[:, 0].reshape((-1, 1))
      else:
          return y_out
  
imports: import warnings
  from io import StringIO
  import numpy
  from sklearn.base import TransformerMixin
  from sklearn.utils import column_or_1d
  from sklearn.utils.validation import check_is_fitted
  from tslearn.backend import instantiate_backend
  from tslearn.bases import TimeSeriesBaseEstimator
label_desc: Use image node_id 4 for calling the LabelCategorizer obj's underlying member method code with example usage: obj.transform(y) and returns: y_out, y_out