code: def test_multiclass_ovr_roc_auc_toydata(setup, y_true, labels):
      # Tests the unweighted, one-vs-rest multiclass ROC AUC algorithm
      # on a small example, representative of an expected use case.
      y_scores = np.array(
          [
              [1.0, 0.0, 0.0],
              [0.1, 0.5, 0.4],
              [0.1, 0.1, 0.8],
              [0.3, 0.3, 0.4],
          ]
      )
      # Compute the expected result by individually computing the 'one-vs-rest'
      # ROC AUC scores for classes 0, 1, and 2.
      out_0 = roc_auc_score([1, 0, 0, 0], y_scores[:, 0])
      out_1 = roc_auc_score([0, 1, 0, 0], y_scores[:, 1])
      out_2 = roc_auc_score([0, 0, 1, 1], y_scores[:, 2])
      result_unweighted = (out_0 + out_1 + out_2) / 3.0
  
      assert_almost_equal(
          roc_auc_score(
              y_true, y_scores, multi_class="ovr", labels=labels
          ),
          result_unweighted,
      )
  
      # Tests the weighted, one-vs-rest multiclass ROC AUC algorithm
      # on the same input (Provost & Domingos, 2000)
      result_weighted = out_0 * 0.25 + out_1 * 0.25 + out_2 * 0.5
      assert_almost_equal(
          roc_auc_score(
              y_true,
              y_scores,
              multi_class="ovr",
              labels=labels,
              average="weighted",
          ),
          result_weighted,
      )
  
imports: import re
  import warnings
  import numpy
  import pandas
  import pytest
  from sklearn.metrics import roc_curve, auc, accuracy_score
  from sklearn.metrics.tests.test_ranking import make_prediction, _auc
  from sklearn.exceptions import UndefinedMetricWarning
  from sklearn.utils import check_random_state
  from sklearn.utils._testing import assert_almost_equal, assert_array_almost_equal
  from ....None import dataframe
  from ....None import tensor
  from ...utils.extmath import softmax
  from ..None import roc_curve, auc, accuracy_score, roc_auc_score
label_desc: Use image node_id 16 for calling a global function with example usage: test_multiclass_ovr_roc_auc_toydata(setup, y_true, labels) without return types