class_docstr: Unit test class for testing scikit-learn sklearn_converter.
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","sklearn_converter","."]
docstr: Test that the same predictions are made
docstr_tok: ["Test","that","the","same","predictions","are","made"]
code: def _test_evaluation(self, allow_slow):
      """
      Test that the same predictions are made
      """
  
      # Generate some smallish (some kernels take too long on anything else) random data
      x, y = [], []
      for _ in range(50):
          cur_x1, cur_x2 = random.gauss(2, 3), random.gauss(-1, 2)
          x.append([cur_x1, cur_x2])
          y.append(1 + 2 * cur_x1 + 3 * cur_x2)
  
      input_names = ["x1", "x2"]
      df = pd.DataFrame(x, columns=input_names)
  
      # Parameters to test
      kernel_parameters = [
          {},
          {"kernel": "rbf", "gamma": 1.2},
          {"kernel": "linear"},
          {"kernel": "poly"},
          {"kernel": "poly", "degree": 2},
          {"kernel": "poly", "gamma": 0.75},
          {"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 = [
          {},
          {"C": 1},
          {"C": 1.5, "epsilon": 0.5, "shrinking": True},
          {"C": 0.5, "epsilon": 1.5, "shrinking": False},
      ]
  
      # Test
      for param1 in non_kernel_parameters:
          for param2 in kernel_parameters:
              cur_params = param1.copy()
              cur_params.update(param2)
              print("cur_params=" + str(cur_params))
  
              cur_model = SVR(**cur_params)
              cur_model.fit(x, y)
              df["target"] = cur_model.predict(x)
  
              spec = sklearn_converter.convert(
                  cur_model, input_names, "target"
              )
  
              if _is_macos() and _macos_version() >= (10, 13):
                  metrics = evaluate_regressor(spec, df)
                  self.assertAlmostEqual(metrics["max_error"], 0)
  
              if not allow_slow:
                  break
  
          if not allow_slow:
              break
  
imports: import random
  import tempfile
  import unittest
  import numpy
  import pandas
  import pytest
  from coremltools._deps import _HAS_LIBSVM, _HAS_SKLEARN, MSG_LIBSVM_NOT_FOUND, MSG_SKLEARN_NOT_FOUND
  from coremltools.models.utils import _is_macos, _macos_version, evaluate_regressor
label_desc: Use image node_id 5 for calling the SvrScikitTest obj's underlying member method code with example usage: obj._test_evaluation(allow_slow) without return types