code: def label_binarize(
      y, classes, neg_label=0, pos_label=1, sparse_output=False
  ) -> SparseCumlArray:
      """
      A stateless helper function to dummy encode multi-class labels.
  
      Parameters
      ----------
  
      y : array-like of size [n_samples,] or [n_samples, n_classes]
      classes : the set of unique classes in the input
      neg_label : integer the negative value for transformed output
      pos_label : integer the positive value for transformed output
      sparse_output : bool whether to return sparse array
      """
  
      classes = cp.asarray(classes, dtype=classes.dtype)
      labels = cp.asarray(y, dtype=y.dtype)
  
      if not check_labels(labels, classes):
          raise ValueError("Unseen classes encountered in input")
  
      row_ind = cp.arange(0, labels.shape[0], 1, dtype=y.dtype)
      col_ind, _ = make_monotonic(labels, classes, copy=True)
  
      # Convert from CumlArray to cupy
      col_ind = cp.asarray(col_ind)
  
      val = cp.full(row_ind.shape[0], pos_label, dtype=y.dtype)
  
      sp = cupyx.scipy.sparse.coo_matrix(
          (val, (row_ind, col_ind)),
          shape=(col_ind.shape[0], classes.shape[0]),
          dtype=cp.float32,
      )
  
      cp.cuda.Stream.null.synchronize()
  
      if sparse_output:
          sp = sp.tocsr()
          return sp
      else:
          arr = sp.toarray().astype(y.dtype)
          arr[arr == 0] = neg_label
  
          return arr
  
file_path: cuml/python/cuml/preprocessing/label.py
imports: from cuml.prims.label import check_labels, invert_labels, make_monotonic
  from cuml.internals.array_sparse import SparseCumlArray
  from cuml.common.array_descriptor import CumlArrayDescriptor
  from cuml.common import CumlArray, has_scipy
  import cuml.internals
  from cuml import Base
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: label_binarize(y, classes, neg_label, pos_label, sparse_output) and returns: sp, arr