code: def test_none_prec_recall_scores(self):
      # Arrange
      y = turicreate.SArray([0, 1, 2])
      yhat = turicreate.SArray([0, 0, 2])
  
      # Act
      avg_cases = ["micro", "macro", None]
      pr = {}
      rec = {}
      f1 = {}
      fbeta = {}
      for avg in avg_cases:
          pr[avg] = turicreate.toolkits.evaluation.precision(
              y, yhat, avg
          )
          rec[avg] = turicreate.toolkits.evaluation.recall(y, yhat, avg)
          f1[avg] = turicreate.toolkits.evaluation.f1_score(
              y, yhat, avg
          )
          fbeta[avg] = turicreate.toolkits.evaluation.fbeta_score(
              y, yhat, 2.0, avg
          )
  
      # Assert
      self.assertAlmostEqual(pr["micro"], 2.0 / 3)
      self.assertAlmostEqual(rec["micro"], 2.0 / 3)
      self.assertAlmostEqual(f1["micro"], 2.0 / 3)
      self.assertAlmostEqual(fbeta["micro"], 2.0 / 3)
  
      self.assertAlmostEqual(pr["macro"], 0.75)
      self.assertAlmostEqual(rec["macro"], 2.0 / 3)
      self.assertAlmostEqual(f1["macro"], 0.5555555555555555)
      self.assertAlmostEqual(fbeta["macro"], 0.6111111111111112)
  
      self.assertEqual(pr[None][1], None)
      self.assertEqual(rec[None][1], 0.0)
      self.assertEqual(f1[None][1], 0.0)
      self.assertEqual(fbeta[None][1], 0.0)
  
      # Arrange
      y = turicreate.SArray(["0", "1", "2"])
      yhat = turicreate.SArray(["0", "0", "2"])
  
      # Act
      avg_cases = ["micro", "macro", None]
      pr = {}
      rec = {}
      f1 = {}
      fbeta = {}
      for avg in avg_cases:
          pr[avg] = turicreate.toolkits.evaluation.precision(
              y, yhat, avg
          )
          rec[avg] = turicreate.toolkits.evaluation.recall(y, yhat, avg)
          f1[avg] = turicreate.toolkits.evaluation.f1_score(
              y, yhat, avg
          )
          fbeta[avg] = turicreate.toolkits.evaluation.fbeta_score(
              y, yhat, 2.0, avg
          )
  
      # Assert
      self.assertAlmostEqual(pr["micro"], 2.0 / 3)
      self.assertAlmostEqual(rec["micro"], 2.0 / 3)
      self.assertAlmostEqual(f1["micro"], 2.0 / 3)
      self.assertAlmostEqual(fbeta["micro"], 2.0 / 3)
  
      self.assertAlmostEqual(pr["macro"], 0.75)
      self.assertAlmostEqual(rec["macro"], 2.0 / 3)
      self.assertAlmostEqual(f1["macro"], 0.5555555555555555)
      self.assertAlmostEqual(fbeta["macro"], 0.6111111111111112)
  
      self.assertEqual(pr[None]["1"], None)
      self.assertEqual(rec[None]["1"], 0.0)
      self.assertEqual(f1[None]["1"], 0.0)
      self.assertEqual(fbeta[None]["1"], 0.0)
  
      # Arrange
      y = turicreate.SArray([0, 0, 2])
      yhat = turicreate.SArray([0, 1, 2])
  
      # Act
      avg_cases = ["micro", "macro", None]
      pr = {}
      rec = {}
      f1 = {}
      fbeta = {}
      for avg in avg_cases:
          pr[avg] = turicreate.toolkits.evaluation.precision(
              y, yhat, avg
          )
          rec[avg] = turicreate.toolkits.evaluation.recall(y, yhat, avg)
          f1[avg] = turicreate.toolkits.evaluation.f1_score(
              y, yhat, avg
          )
          fbeta[avg] = turicreate.toolkits.evaluation.fbeta_score(
              y, yhat, 2.0, avg
          )
  
      # Assert
      self.assertAlmostEqual(pr["micro"], 2.0 / 3)
      self.assertAlmostEqual(rec["micro"], 2.0 / 3)
      self.assertAlmostEqual(f1["micro"], 2.0 / 3)
      self.assertAlmostEqual(fbeta["micro"], 2.0 / 3)
  
      self.assertAlmostEqual(pr["macro"], 2.0 / 3)
      self.assertAlmostEqual(rec["macro"], 0.75)
      self.assertAlmostEqual(f1["macro"], 0.5555555555555555)
      self.assertAlmostEqual(fbeta["macro"], 0.5185185185185185)
  
      self.assertEqual(pr[None][1], 0.0)
      self.assertEqual(rec[None][1], None)
      self.assertEqual(f1[None][1], 0.0)
      self.assertEqual(fbeta[None][1], 0.0)
  
      # Arrange
      y = turicreate.SArray(["0", "0", "2"])
      yhat = turicreate.SArray(["0", "1", "2"])
  
      # Act
      avg_cases = ["micro", "macro", None]
      pr = {}
      rec = {}
      f1 = {}
      fbeta = {}
      for avg in avg_cases:
          pr[avg] = turicreate.toolkits.evaluation.precision(
              y, yhat, avg
          )
          rec[avg] = turicreate.toolkits.evaluation.recall(y, yhat, avg)
          f1[avg] = turicreate.toolkits.evaluation.f1_score(
              y, yhat, avg
          )
          fbeta[avg] = turicreate.toolkits.evaluation.fbeta_score(
              y, yhat, 2.0, avg
          )
  
      # Assert
      self.assertAlmostEqual(pr["micro"], 2.0 / 3)
      self.assertAlmostEqual(rec["micro"], 2.0 / 3)
      self.assertAlmostEqual(f1["micro"], 2.0 / 3)
      self.assertAlmostEqual(fbeta["micro"], 2.0 / 3)
  
      self.assertAlmostEqual(pr["macro"], 2.0 / 3)
      self.assertAlmostEqual(rec["macro"], 0.75)
      self.assertAlmostEqual(f1["macro"], 0.5555555555555555)
      self.assertAlmostEqual(fbeta["macro"], 0.5185185185185185)
  
      self.assertEqual(pr[None]["1"], 0.0)
      self.assertEqual(rec[None]["1"], None)
      self.assertEqual(f1[None]["1"], 0.0)
      self.assertEqual(fbeta[None]["1"], 0.0)
  
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 8 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_none_prec_recall_scores() without return types