class_docstr: Unit test class for testing scikit-learn converter.
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","converter","."]
code: def _evaluation_test_helper(
      self,
      class_labels,
      use_probability_estimates,
      allow_slow,
      allowed_prob_delta=0.00001,
  ):
      # Parameters to test
      kernel_parameters = [
          {},
          {"kernel": "rbf", "gamma": 1.2},
          {"kernel": "linear"},
          {"kernel": "poly"},
          {"kernel": "poly", "degree": 2},
          {"kernel": "poly", "gamma": 0.75},
      ]
      # sklearn version > 0.22 NuSVC introduced finiteness checks that fail for
      # the 'sigmoid' and one 'poly' kernel test cases. Avoid those.
      # See https://github.com/scikit-learn/scikit-learn/issues/17925
      if _SKLEARN_VERSION <= StrictVersion("0.22"):
          kernel_parameters += [
              {"kernel": "poly", "degree": 0, "gamma": 0.9, "coef0": 2},
              {"kernel": "sigmoid"},
              {"kernel": "sigmoid", "gamma": 1.3},
              {"kernel": "sigmoid", "coef0": 0.8},
              {"kernel": "sigmoid", "coef0": 0.8, "gamma": 0.5},
          ]
  
      non_kernel_parameters = [
          {},
          {"nu": 0.75},
          {"nu": 0.25, "shrinking": True},
          {"shrinking": False},
      ]
  
      # Generate some random data
      x, y = [], []
      random.seed(42)
      for _ in range(50):
          x.append(
              [
                  random.gauss(200, 30),
                  random.gauss(-100, 22),
                  random.gauss(100, 42),
              ]
          )
          y.append(random.choice(class_labels))
      column_names = ["x1", "x2", "x3"]
      # make sure first label is seen first, second is seen second, and so on.
      for i, val in enumerate(class_labels):
          y[i] = val
      df = pd.DataFrame(x, columns=column_names)
  
      # Test
      for param1 in non_kernel_parameters:
          for param2 in kernel_parameters:
              cur_params = param1.copy()
              cur_params.update(param2)
              cur_params["probability"] = use_probability_estimates
              cur_params[
                  "max_iter"
              ] = 10  # Don't want test to take too long
  
              cur_model = NuSVC(**cur_params)
              cur_model.fit(x, y)
  
              spec = scikit_converter.convert(
                  cur_model, column_names, "target"
              )
  
              if _is_macos() and _macos_version() >= (10, 13):
                  if use_probability_estimates:
                      probability_lists = cur_model.predict_proba(x)
                      df["classProbability"] = [
                          dict(zip(cur_model.classes_, cur_vals))
                          for cur_vals in probability_lists
                      ]
                      metrics = evaluate_classifier_with_probabilities(
                          spec, df, probabilities="classProbability"
                      )
                      self.assertEqual(metrics["num_key_mismatch"], 0)
                      self.assertLess(
                          metrics["max_probability_error"],
                          allowed_prob_delta,
                      )
                  else:
                      df["target"] = cur_model.predict(x)
                      metrics = evaluate_classifier(
                          spec, df, verbose=False
                      )
                      self.assertEqual(metrics["num_errors"], 0)
  
              if not allow_slow:
                  break
  
          if not allow_slow:
              break
  
imports: import random
  import tempfile
  import unittest
  import pandas
  import pytest
  from coremltools._deps import _HAS_LIBSVM, _HAS_SKLEARN, _SKLEARN_VERSION, MSG_LIBSVM_NOT_FOUND, MSG_SKLEARN_NOT_FOUND
  from coremltools.models.utils import _is_macos, _macos_version, evaluate_classifier, evaluate_classifier_with_probabilities
label_desc: Use image node_id 1 for calling the NuSvcScikitTest obj's underlying member method code with example usage: obj._evaluation_test_helper(class_labels, use_probability_estimates, allow_slow, allowed_prob_delta) without return types