code: def test_predict(self):
      # default ('class') output_type
      predictions = self.model.predict(self.data["audio"])
      _raise_error_if_not_sarray(predictions)
      self.assertEqual(len(predictions), len(self.data))
      for a, b in zip(predictions, self.data["labels"]):
          self.assertEqual(a, b)
  
      # 'probability' output_type
      if self.is_binary_classification:
          predictions = self.model.predict(
              self.data["audio"], output_type="probability"
          )
          _raise_error_if_not_sarray(predictions)
          self.assertEqual(len(predictions), len(self.data))
          for probabilities, correct_label in zip(
              predictions, self.data["labels"]
          ):
              # correct value has highest probability?
              correct_index = self.model.classes.index(correct_label)
              self.assertEqual(np.argmax(probabilities), correct_index)
              # all probabilities sum close to 1?
              self.assertTrue(abs(np.sum(probabilities) - 1) < 0.00001)
      else:
          # 'probability' output type only supported for binary classification
          with self.assertRaises(ToolkitError):
              self.model.predict(
                  self.data["audio"], output_type="probability"
              )
  
      # 'probability_vector' output_type
      predictions = self.model.predict(
          self.data["audio"], output_type="probability_vector"
      )
      _raise_error_if_not_sarray(predictions)
      self.assertEqual(len(predictions), len(self.data))
      for prob_vector, correct_label in zip(
          predictions, self.data["labels"]
      ):
          # correct value has highest probability?
          correct_index = self.model.classes.index(correct_label)
          self.assertEqual(np.argmax(prob_vector), correct_index)
          # all probabilities sum close to 1?
          self.assertTrue(abs(np.sum(prob_vector) - 1) < 0.00001)
  
      # predict with single (dict) example
      single_prediction = self.model.predict(self.data["audio"][0])
      _raise_error_if_not_sarray(single_prediction)
      self.assertEqual(len(single_prediction), 1)
      self.assertEqual(single_prediction[0], self.data["labels"][0])
  
      # predict with SFrame
      data = self.data.copy()
      del data["labels"]
      predictions = self.model.predict(data)
      _raise_error_if_not_sarray(predictions)
      self.assertEqual(len(predictions), len(data))
      for a, b in zip(predictions, self.data["labels"]):
          self.assertEqual(a, b)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from .util import TempDirectory
  from copy import copy
  import math
  from os import mkdir
  import unittest
  import pytest
  import numpy
  import sys
  import turicreate
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sarray
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._internal_utils import _mac_ver
label_desc: Use image node_id 5 for calling the ClassifierTestTwoClassesStringLabels obj's underlying member method code with example usage: obj.test_predict() without return types