code: def _multiclass_roc_auc_score(
      y_true,
      y_score,
      labels,
      multi_class,
      average,
      sample_weight,
      session=None,
      run_kwargs=None,
  ):
      # validation of the input y_score
      if not mt.allclose(1, y_score.sum(axis=1)).to_numpy(
          session=session, **(run_kwargs or dict())
      ):  # pragma: no cover
          raise ValueError(
              "Target scores need to be probabilities for multiclass "
              "roc_auc, i.e. they should sum up to 1.0 over classes"
          )
  
      # validation for multiclass parameter specifications
      average_options = ("macro", "weighted")
      if average not in average_options:
          raise ValueError(
              "average must be one of {0} for multiclass problems".format(
                  average_options
              )
          )
  
      multiclass_options = ("ovo", "ovr")
      if multi_class not in multiclass_options:
          raise ValueError(
              "multi_class='{0}' is not supported "
              "for multiclass ROC AUC, multi_class must be "
              "in {1}".format(multi_class, multiclass_options)
          )
  
      if labels is not None:
          labels = column_or_1d(labels).to_numpy(
              session=session, **(run_kwargs or dict())
          )
          classes = _unique(labels).to_numpy(
              session=session, **(run_kwargs or dict())
          )
          if len(classes) != len(labels):
              raise ValueError("Parameter 'labels' must be unique")
          if not np.array_equal(classes, labels):
              raise ValueError("Parameter 'labels' must be ordered")
          if len(classes) != y_score.shape[1]:
              raise ValueError(
                  "Number of given labels, {0}, not equal to the number "
                  "of columns in 'y_score', {1}".format(
                      len(classes), y_score.shape[1]
                  )
              )
          if len(
              mt.setdiff1d(y_true, classes).execute(
                  session=session, **(run_kwargs or dict())
              )
          ):
              raise ValueError(
                  "'y_true' contains labels not in parameter 'labels'"
              )
      else:
          classes = _unique(y_true).execute(
              session=session, **(run_kwargs or dict())
          )
          if len(classes) != y_score.shape[1]:
              raise ValueError(
                  "Number of classes in y_true not equal to the number of "
                  "columns in 'y_score'"
              )
  
      if multi_class == "ovo":
          if sample_weight is not None:
              raise ValueError(
                  "sample_weight is not supported "
                  "for multiclass one-vs-one ROC AUC, "
                  "'sample_weight' must be None in this case."
              )
          y_true_encoded = _encode(y_true, uniques=classes)
          # Hand & Till (2001) implementation (ovo)
          return _average_multiclass_ovo_score(
              _binary_roc_auc_score,
              y_true_encoded,
              y_score,
              average=average,
              session=session,
              run_kwargs=run_kwargs,
          )
      else:
          # ovr is same as multi-label
          y_true_multilabel = label_binarize(
              y_true, classes=classes, execute=False
          )
          return _average_binary_score(
              _binary_roc_auc_score,
              y_true_multilabel,
              y_score,
              average,
              sample_weight=sample_weight,
              session=session,
              run_kwargs=run_kwargs,
          )
  
file_path: mars/mars/learn/metrics/_ranking.py
imports: import warnings
  from functools import partial
  import numpy
  from ...None import execute, fetch
  from ...None import tensor
  from ...utils import cache_tileables
  from ..preprocessing import label_binarize
  from ..utils._encode import _encode, _unique
  from ..utils.checks import assert_all_finite
  from ..utils.core import sort_by
  from ..utils.multiclass import type_of_target
  from ..utils.validation import check_array, check_consistent_length, column_or_1d
  from ._base import _average_binary_score, _average_multiclass_ovo_score
label_desc: Use image node_id 5 for calling a global function with example usage: _multiclass_roc_auc_score(y_true, y_score, labels, multi_class, average, sample_weight, session, run_kwargs) and returns: _average_multiclass_ovo_score, _average_binary_score