class_docstr: Unit test class for correctness of model predictions.
class_docstr_tok: ["Unit","test","class","for","correctness","of","model","predictions","."]
docstr: Make sure evaluate works and the results are plausible. In the future
  check correctness as well.
docstr_tok: ["Make","sure","evaluate","works","and","the","results","are","plausible",".","In","the","future","check","correctness","as","well","."]
code: def test_evaluate(self):
      """
      Make sure evaluate works and the results are plausible. In the future
      check correctness as well.
      """
      ans = self.model.evaluate(self.sf)
  
      ## Check that the right keys are present in the results dict.
      self.assertItemsEqual(
          ans.keys(), ["accuracy", "confusion_matrix"]
      )
  
      ## Check plausibility of the accuracy.
      self.assertIsInstance(ans["accuracy"], float)
      self.assertTrue(ans["accuracy"] >= 0 and ans["accuracy"] <= 1)
  
      ## Check plausibility of the confusion matrix.
      self.assertIsInstance(ans["confusion_matrix"], tc.SFrame)
      self.assertEqual(ans["confusion_matrix"].num_columns(), 3)
      self.assertEqual(
          len(ans["confusion_matrix"]["target_label"].unique()), 3
      )
      self.assertEqual(ans["confusion_matrix"]["count"].sum(), 100)
  
      ## Check the values and types of the confusion matrix of *none* of the
      #  test points have *any* qualified neighbors in the training set.
      evals = self.model.evaluate(
          self.sf_test, max_neighbors=None, radius=1e-6
      )
      acc = evals["accuracy"]
      cf_mat = evals["confusion_matrix"]
  
      self.assertTrue(acc == 0.0)
      self.assertTrue(all(cf_mat["target_label"] != None))
      self.assertTrue(all(cf_mat["predicted_label"] == None))
      self.assertItemsEqual(cf_mat.column_types(), [str, float, int])
      self.assertEqual(cf_mat["count"].sum(), self.sf_test.num_rows())
  
      ## Check that the results are correct if *some*, but not *all* of the
      #  test points have no qualified neighbors in the training set.
      evals = self.model.evaluate(
          self.sf_test, max_neighbors=None, radius=15.0
      )
      acc = evals["accuracy"]
      cf_mat = evals["confusion_matrix"]
  
      self.assertTrue(acc >= 0.0 and acc <= 1.0)
      self.assertItemsEqual(cf_mat.column_types(), [str, str, int])
      self.assertItemsEqual(
          cf_mat["target_label"].unique(),
          self.sf_test["class"].unique(),
      )
      self.assertTrue(
          cf_mat["predicted_label"].countna() > 0
          and cf_mat["predicted_label"].countna()
          < self.sf_test.num_rows()
      )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import copy
  import array
  import numpy
  import turicreate
  from .None import util
  from turicreate.util import _assert_sframe_equal
  from turicreate.toolkits._main import ToolkitError
  import sys
label_desc: Use image node_id 6 for calling the KnnClassifierPredictTest obj's underlying member method code with example usage: obj.test_evaluate() without return types