code: def test_predict_topk(self):
      ks = [self.model.num_classes - 1, self.model.num_classes]
  
      for k in ks:
          y1 = self.model.predict_topk(
              self.dtest, k=k, output_type="rank"
          )
          self.assertEqual(y1["class"].dtype, self.type)
          self.assertEqual(y1["id"].dtype, int)
          self.assertEqual(y1.num_rows(), self.dtest.num_rows() * k)
  
          y2 = self.model.predict_topk(
              self.dtest, k=k, output_type="probability"
          )
          self.assertEqual(y2["id"].dtype, int)
          self.assertEqual(y2.num_rows(), self.dtest.num_rows() * k)
  
          y3 = self.model.predict_topk(
              self.dtest, k=k, output_type="margin"
          )
          self.assertEqual(y3["id"].dtype, int)
          self.assertEqual(y3.num_rows(), self.dtest.num_rows() * k)
          self.assertTrue(all(y3[y3["class"] == 0]["margin"] == 0.0))
  
          test_sf = tc.SFrame()
          test_sf["rank"] = y1["class"]
          test_sf["prob"] = y2["class"]
          test_sf["margin"] = y3["class"]
          test_sf["error"] = test_sf.apply(
              lambda x: x["rank"] != x["prob"]
              or x["rank"] != x["margin"]
          )
  
          self.assertEqual(test_sf["error"].sum(), 0)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import turicreate
  import uuid
  import random
  import copy
  from turicreate.toolkits._main import ToolkitError
  import turicreate.toolkits.evaluation
  import shutil
  from array import array
  import os
label_desc: Use image node_id 7 for calling the BoostedTreesClassifierTest obj's underlying member method code with example usage: obj.test_predict_topk() without return types