code: def test_auc_multi_class_score(self):
      # Arrange
      t, p = _generate_classes_and_scores(
          3, n=100, hard_predictions=False
      )
      sk_p = {}
      sk_t = {}
      for i in range(3):
          sk_p[i] = p[:, i]
          sk_t[i] = t == i
      targets = turicreate.SArray(t)
      predictions = turicreate.SArray(p)
      str_targets = targets.astype(str)
  
      # Act
      sk_score = {}
      for i in range(3):
          sk_score[i] = roc_auc_score(sk_t[i], sk_p[i])
  
      # Act [Average = None]
      score = turicreate.toolkits.evaluation.auc(
          targets, predictions, average=None
      )
      str_score = turicreate.toolkits.evaluation.auc(
          str_targets, predictions, average=None
      )
      # Assert
      self.assertEqual(type(score), dict)
      self.assertEqual(set(score.keys()), set([0, 1, 2]))
      self.assertEqual(set(str_score.keys()), set(["0", "1", "2"]))
  
      # Note: Explicitly not putting it into a for loop for ease of
      # debugging when the tests fail.
      self.assertAlmostEqual(sk_score[0], score[0], places=2)
      self.assertAlmostEqual(sk_score[0], str_score["0"], places=2)
      self.assertAlmostEqual(sk_score[1], score[1], places=2)
      self.assertAlmostEqual(sk_score[1], str_score["1"], places=2)
      self.assertAlmostEqual(sk_score[2], score[2], places=2)
      self.assertAlmostEqual(sk_score[2], str_score["2"], places=2)
  
      # Act [Average = 'macro']
      score = turicreate.toolkits.evaluation.auc(
          targets, predictions, average="macro"
      )
      str_score = turicreate.toolkits.evaluation.auc(
          str_targets, predictions, average="macro"
      )
      avg_score = 0.0
      for i in range(3):
          avg_score += sk_score[i]
      avg_score /= 3.0
      self.assertAlmostEqual(avg_score, score, places=2)
      self.assertAlmostEqual(avg_score, str_score, places=2)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import turicreate
  from turicreate.toolkits._main import ToolkitError
  import math
  from numpy import inf
  import numpy
label_desc: Use image node_id 26 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_auc_multi_class_score() without return types