code: def tile(cls, op: "LabelBinarize"):
      y = op.y
      classes = op.classes
      neg_label = op.neg_label
      pos_label = op.pos_label
      sparse_output = op.sparse_output
      out = op.outputs[0]
      ctx = get_context()
  
      if isinstance(y, list):
          if _num_samples(y) == 0:
              raise ValueError("y has 0 samples: %r" % y)
  
      if len(op.inputs) == 0:
          # no entity input
          r = sklearn_label_binarize(
              op.y,
              classes=op.classes,
              neg_label=neg_label,
              pos_label=pos_label,
              sparse_output=sparse_output,
          )
          return (yield from recursive_tile(mt.tensor(r)))
      else:
          # trigger execution
          yield
  
      if neg_label >= pos_label:
          raise ValueError(
              "neg_label={0} must be strictly less than "
              "pos_label={1}.".format(neg_label, pos_label)
          )
  
      if sparse_output and (pos_label == 0 or neg_label != 0):
          raise ValueError(
              "Sparse binarization is only supported with non "
              "zero pos_label and zero neg_label, got "
              "pos_label={0} and neg_label={1}"
              "".format(pos_label, neg_label)
          )
  
      # To account for pos_label == 0 in the dense case
      pos_switch = pos_label == 0
      if pos_switch:
          pos_label = -neg_label
  
      y_type = yield from recursive_tile(type_of_target(y))
      yield y_type.chunks
      y_type = ctx.get_chunks_result([y_type.chunks[0].key])[0]
      y_type = y_type.item() if hasattr(y_type, "item") else y_type
      if "multioutput" in y_type:
          raise ValueError(
              "Multioutput target data is not supported with label binarization"
          )
      if y_type == "unknown":
          raise ValueError("The type of target data is not known")
  
      n_samples = mt.tensor(y).shape[0]
      n_classes = len(classes)
  
      if y_type == "binary":
          if n_classes == 1:
              if sparse_output:
                  return (
                      yield from recursive_tile(
                          mt.zeros(
                              (n_samples, 1), dtype=int, sparse=True
                          )
                      )
                  )
              else:
                  Y = mt.zeros((len(y), 1), dtype=int)
                  Y += neg_label
                  return (yield from recursive_tile(Y))
          elif len(classes) >= 3:
              y_type = "multiclass"
  
      if y_type == "multilabel-indicator":
          y_n_classes = y.shape[1] if hasattr(y, "shape") else len(y[0])
          if mt.tensor(classes).size != y_n_classes:
              raise ValueError(
                  "classes {0} mismatch with the labels {1}"
                  " found in the data".format(classes, unique_labels(y))
              )
  
      if y_type in ("binary", "multiclass"):
          y = yield from recursive_tile(column_or_1d(y))
          if y_type == "binary":
              out_shape = (n_samples, 1)
          else:
              out_shape = (n_samples, n_classes)
      elif y_type == "multilabel-indicator":
          out_shape = y.shape
      else:
          raise ValueError(
              "%s target data is not supported with label binarization"
              % y_type
          )
  
      out_chunks = []
      for y_chunk in y.chunks:
          chunk_inputs = [y_chunk]
          classes_chunk = classes
          if isinstance(classes, ENTITY_TYPE):
              chunk_inputs.append(classes.chunks[0])
              classes_chunk = classes.chunks[0]
          chunk_op = LabelBinarize(
              y=y_chunk,
              classes=classes_chunk,
              neg_label=neg_label,
              pos_label=pos_label,
              sparse_output=sparse_output,
              y_type=y_type,
              pos_switch=pos_switch,
              _output_types=op.output_types,
          )
          if len(out_shape) == 2:
              chunk_shape = (y_chunk.shape[0], out_shape[1])
              chunk_index = (y_chunk.index[0], 0)
          else:  # pragma: no cover
              chunk_shape = (y_chunk.shape[0],)
              chunk_index = (y_chunk.index[0],)
          out_chunk = chunk_op.new_chunk(
              chunk_inputs,
              shape=chunk_shape,
              dtype=out.dtype,
              order=out.order,
              index=chunk_index,
          )
          out_chunks.append(out_chunk)
  
      params = out.params.copy()
      params["chunks"] = out_chunks
      params["shape"] = out_shape
      if len(out_shape) == 2:
          nsplits = (y.nsplits[0], (out_shape[1],))
      else:  # pragma: no cover
          nsplits = (y.nsplits[0],)
      params["nsplits"] = nsplits
      return op.copy().new_tileables(op.inputs, kws=[params])
  
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 3 for calling the LabelBinarize obj's underlying member method code with example usage: obj.tile(cls, op) and returns: op, unknown, unknown, unknown