class_docstr: Binarize labels in a one-vs-all fashion.
  
  Several regression and binary classification algorithms are
  available in scikit-learn. A simple way to extend these algorithms
  to the multi-class classification case is to use the so-called
  one-vs-all scheme.
  
  At learning time, this simply consists in learning one regressor
  or binary classifier per class. In doing so, one needs to convert
  multi-class labels to binary labels (belong or does not belong
  to the class). LabelBinarizer makes this process easy with the
  transform method.
  
  At prediction time, one assigns the class for which the corresponding
  model gave the greatest confidence. LabelBinarizer makes this easy
  with the inverse_transform method.
  
  Read more in the :ref:`User Guide <preprocessing_targets>`.
  
  Parameters
  ----------
  
  neg_label : int, default=0
      Value with which negative labels must be encoded.
  
  pos_label : int, default=1
      Value with which positive labels must be encoded.
  
  sparse_output : bool, default=False
      True if the returned array from transform is desired to be in sparse
      CSR format.
  
  Attributes
  ----------
  
  classes_ : ndarray of shape (n_classes,)
      Holds the label for each class.
  
  y_type_ : str
      Represents the type of the target data as evaluated by
      utils.multiclass.type_of_target. Possible type are 'continuous',
      'continuous-multioutput', 'binary', 'multiclass',
      'multiclass-multioutput', 'multilabel-indicator', and 'unknown'.
  
  sparse_input_ : bool
      True if the input data to transform is given as a sparse matrix, False
      otherwise.
  
  Examples
  --------
  >>> from mars.learn import preprocessing
  >>> lb = preprocessing.LabelBinarizer()
  >>> lb.fit([1, 2, 6, 4, 2])
  LabelBinarizer()
  >>> lb.classes_
  array([1, 2, 4, 6])
  >>> lb.transform([1, 6])
  array([[1, 0, 0, 0],
         [0, 0, 0, 1]])
  
  Binary targets transform to a column vector
  
  >>> lb = preprocessing.LabelBinarizer()
  >>> lb.fit_transform(['yes', 'no', 'no', 'yes'])
  array([[1],
         [0],
         [0],
         [1]])
  
  Passing a 2D matrix for multilabel classification
  
  >>> import numpy as np
  >>> lb.fit(np.array([[0, 1, 1], [1, 0, 0]]))
  LabelBinarizer()
  >>> lb.classes_
  array([0, 1, 2])
  >>> lb.transform([0, 1, 2, 1])
  array([[1, 0, 0],
         [0, 1, 0],
         [0, 0, 1],
         [0, 1, 0]])
  
  See Also
  --------
  label_binarize : Function to perform the transform operation of
      LabelBinarizer with fixed classes.
  OneHotEncoder : Encode categorical features using a one-hot aka one-of-K
      scheme.
class_docstr_tok: ["Binarize","labels","in","a","one-vs-all","fashion",".","Several","regression","and","binary","classification","algorithms","are","available","in","scikit-learn",".","A","simple","way","to","extend","these","algorithms","to","the","multi-class","classification","case","is","to","use","the","so-called","one-vs-all","scheme",".","At","learning","time",",","this","simply","consists","in","learning","one","regressor","or","binary","classifier","per","class",".","In","doing","so",",","one","needs","to","convert","multi-class","labels","to","binary","labels","(","belong","or","does","not","belong","to","the","class",")",".","LabelBinarizer","makes","this","process","easy","with","the","transform","method",".","At","prediction","time",",","one","assigns","the","class","for","which","the","corresponding","model","gave","the","greatest","confidence",".","LabelBinarizer","makes","this","easy","with","the","inverse_transform","method",".","Read","more","in","the",":","ref",":","`","User","Guide","<","preprocessing_targets",">","`",".","Parameters","--","--","--","--","--","neg_label",":","int",",","default=0","Value","with","which","negative","labels","must","be","encoded",".","pos_label",":","int",",","default=1","Value","with","which","positive","labels","must","be","encoded",".","sparse_output",":","bool",",","default=False","True","if","the","returned","array","from","transform","is","desired","to","be","in","sparse","CSR","format",".","Attributes","--","--","--","--","--","classes_",":","ndarray","of","shape","(","n_classes",",",")","Holds","the","label","for","each","class",".","y_type_",":","str","Represents","the","type","of","the","target","data","as","evaluated","by","utils.multiclass.type_of_target",".","Possible","type","are","'continuous","'",",","'continuous-multioutput","'",",","'binary","'",",","'multiclass","'",",","'multiclass-multioutput","'",",","'multilabel-indicator","'",",","and","'unknown","'",".","sparse_input_",":","bool","True","if","the","input","data","to","transform","is","given","as","a","sparse","matrix",",","False","otherwise",".","Examples","--","--","--","--",">",">",">","from","mars.learn","import","preprocessing",">",">",">","lb","=","preprocessing.LabelBinarizer","(",")",">",">",">","lb.fit","(","[","1",",","2",",","6",",","4",",","2","]",")","LabelBinarizer","(",")",">",">",">","lb.classes_","array","(","[","1",",","2",",","4",",","6","]",")",">",">",">","lb.transform","(","[","1",",","6","]",")","array","(","[","[","1",",","0",",","0",",","0","]",",","[","0",",","0",",","0",",","1","]","]",")","Binary","targets","transform","to","a","column","vector",">",">",">","lb","=","preprocessing.LabelBinarizer","(",")",">",">",">","lb.fit_transform","(","[","'yes","'",",","'no","'",",","'no","'",",","'yes","'","]",")","array","(","[","[","1","]",",","[","0","]",",","[","0","]",",","[","1","]","]",")","Passing","a","2D","matrix","for","multilabel","classification",">",">",">","import","numpy","as","np",">",">",">","lb.fit","(","np.array","(","[","[","0",",","1",",","1","]",",","[","1",",","0",",","0","]","]",")",")","LabelBinarizer","(",")",">",">",">","lb.classes_","array","(","[","0",",","1",",","2","]",")",">",">",">","lb.transform","(","[","0",",","1",",","2",",","1","]",")","array","(","[","[","1",",","0",",","0","]",",","[","0",",","1",",","0","]",",","[","0",",","0",",","1","]",",","[","0",",","1",",","0","]","]",")","See","Also","--","--","--","--","label_binarize",":","Function","to","perform","the","transform","operation","of","LabelBinarizer","with","fixed","classes",".","OneHotEncoder",":","Encode","categorical","features","using","a","one-hot","aka","one-of-K","scheme","."]
docstr: Transform binary labels back to multi-class labels.
  
  Parameters
  ----------
  Y : {ndarray, sparse matrix} of shape (n_samples, n_classes)
      Target values. All sparse matrices are converted to CSR before
      inverse transformation.
  
  threshold : float, default=None
      Threshold used in the binary and multi-label cases.
  
      Use 0 when ``Y`` contains the output of decision_function
      (classifier).
      Use 0.5 when ``Y`` contains the output of predict_proba.
  
      If None, the threshold is assumed to be half way between
      neg_label and pos_label.
  
  Returns
  -------
  y : {ndarray, sparse matrix} of shape (n_samples,)
      Target values. Sparse matrix will be of CSR format.
  
  Notes
  -----
  In the case when the binary labels are fractional
  (probabilistic), inverse_transform chooses the class with the
  greatest value. Typically, this allows to use the output of a
  linear model's decision_function method directly as the input
  of inverse_transform.
docstr_tok: ["Transform","binary","labels","back","to","multi-class","labels",".","Parameters","--","--","--","--","--","Y",":","{","ndarray",",","sparse","matrix","}","of","shape","(","n_samples",",","n_classes",")","Target","values",".","All","sparse","matrices","are","converted","to","CSR","before","inverse","transformation",".","threshold",":","float",",","default=None","Threshold","used","in","the","binary","and","multi-label","cases",".","Use","0","when","``","Y","``","contains","the","output","of","decision_function","(","classifier",")",".","Use","0.5","when","``","Y","``","contains","the","output","of","predict_proba",".","If","None",",","the","threshold","is","assumed","to","be","half","way","between","neg_label","and","pos_label",".","Returns","--","--","--","-","y",":","{","ndarray",",","sparse","matrix","}","of","shape","(","n_samples",",",")","Target","values",".","Sparse","matrix","will","be","of","CSR","format",".","Notes","--","--","-","In","the","case","when","the","binary","labels","are","fractional","(","probabilistic",")",",","inverse_transform","chooses","the","class","with","the","greatest","value",".","Typically",",","this","allows","to","use","the","output","of","a","linear","model","'s","decision_function","method","directly","as","the","input","of","inverse_transform","."]
code: def inverse_transform(self, Y, threshold=None):
      """Transform binary labels back to multi-class labels.
  
      Parameters
      ----------
      Y : {ndarray, sparse matrix} of shape (n_samples, n_classes)
          Target values. All sparse matrices are converted to CSR before
          inverse transformation.
  
      threshold : float, default=None
          Threshold used in the binary and multi-label cases.
  
          Use 0 when ``Y`` contains the output of decision_function
          (classifier).
          Use 0.5 when ``Y`` contains the output of predict_proba.
  
          If None, the threshold is assumed to be half way between
          neg_label and pos_label.
  
      Returns
      -------
      y : {ndarray, sparse matrix} of shape (n_samples,)
          Target values. Sparse matrix will be of CSR format.
  
      Notes
      -----
      In the case when the binary labels are fractional
      (probabilistic), inverse_transform chooses the class with the
      greatest value. Typically, this allows to use the output of a
      linear model's decision_function method directly as the input
      of inverse_transform.
      """
      check_is_fitted(self)
  
      if threshold is None:
          threshold = (self.pos_label + self.neg_label) / 2.0
  
      Y = mt.asarray(Y)
      if self.y_type_ == "multiclass":
          y_inv = Y.map_chunk(
              _inverse_binarize_multiclass,
              args=(self.classes_,),
              dtype=self.classes_.dtype,
              shape=(Y.shape[0],),
          )
      else:
          shape = (
              (Y.shape[0],)
              if self.y_type_ != "multilabel-indicator"
              else Y.shape
          )
          y_inv = Y.map_chunk(
              _inverse_binarize_thresholding,
              args=(self.y_type_, self.classes_, threshold),
              dtype=self.classes_.dtype,
              shape=shape,
          )
  
      if self.sparse_input_:
          y_inv = y_inv.tosparse()
      elif y_inv.issparse():
          y_inv = y_inv.todense()
  
      return y_inv
  
imports: from typing import Union
  import numpy
  import scipy.sparse
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.preprocessing import label_binarize
  from sklearn.utils.sparsefuncs import min_max_axis
  from ...None import execute, fetch
  from ...None import opcodes
  from ...None import tensor
  from ...core import ENTITY_TYPE, OutputType, recursive_tile
  from ...core.context import get_context, Context
  from ...lib.sparse import SparseNDArray
  from ...serialization.serializables import AnyField, BoolField, Int32Field, StringField
  from ...tensor.core import TensorOrder
  from ...typing import TileableType
  from ..operands import LearnOperand, LearnOperandMixin
  from ..utils import column_or_1d
  from ..utils._encode import _unique, _encode
  from ..utils.multiclass import unique_labels, type_of_target
  from ..utils.validation import _num_samples, check_is_fitted, check_array
label_desc: Use image node_id 5 for calling the LabelBinarizer obj's underlying member method code with example usage: obj.inverse_transform(Y, threshold) and returns: y_inv