code: def test_grouped_precision_recall(self):
      data = turicreate.SFrame()
      data["user_id"] = ["a", "b", "b", "c", "c", "c"]
      data["item_id"] = ["x", "x", "y", "v", "w", "z"]
      data["rating"] = [0, 1, 2, 3, 4, 5]
      m = turicreate.recommender.item_similarity_recommender.create(
          data
      )
      recs = m.recommend()
  
      test_data = turicreate.SFrame()
      test_data["user_id"] = ["a", "b"]
      test_data["item_id"] = ["v", "z"]
      test_data["rating"] = [7, 8]
  
      pr = turicreate.recommender.util.precision_recall_by_user(
          test_data, recs, cutoffs=[3]
      )
  
      self.assertEqual(type(pr), turicreate.SFrame)
      self.assertEqual(
          pr.column_names(),
          ["user_id", "cutoff", "precision", "recall", "count"],
      )
      self.assertEqual(
          list(pr["user_id"]), list(turicreate.SArray(["a", "b", "c"]))
      )
      pr = turicreate.recommender.util.precision_recall_by_user(
          test_data, recs, cutoffs=[5, 10, 15]
      )
      self.assertEqual(pr.num_rows(), 9)
  
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 12 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_grouped_precision_recall() without return types