class_docstr: Unit test class for testing scikit-learn converter and running both models
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","converter","and","running","both","models"]
docstr: Train a scikit-learn model, convert it and then evaluate it with CoreML
docstr_tok: ["Train","a","scikit-learn","model",",","convert","it","and","then","evaluate","it","with","CoreML"]
code: def _train_convert_evaluate_assert(self, **scikit_params):
      """
      Train a scikit-learn model, convert it and then evaluate it with CoreML
      """
      scikit_model = GradientBoostingClassifier(
          random_state=1, **scikit_params
      )
      scikit_model.fit(self.X, self.target)
  
      # Convert the model
      spec = skl_converter.convert(
          scikit_model, self.feature_names, self.output_name
      )
  
      if (
          hasattr(scikit_model, "_init_decision_function")
          and scikit_model.n_classes_ > 2
      ):
          # fix initial default prediction for multiclass classification
          # https://github.com/scikit-learn/scikit-learn/pull/12983
          assert hasattr(scikit_model, "init_")
          assert hasattr(scikit_model.init_, "priors")
          scikit_model.init_.priors = np.log(scikit_model.init_.priors)
  
      if _is_macos() and _macos_version() >= (10, 13):
          # Get predictions
          df = pd.DataFrame(self.X, columns=self.feature_names)
          df["target"] = scikit_model.predict(self.X)
  
          # Evaluate it
          metrics = evaluate_classifier(spec, df)
          self._check_metrics(metrics)
  
imports: import itertools
  import unittest
  import numpy
  import pandas
  import pytest
  from coremltools._deps import _HAS_SKLEARN, _HAS_XGBOOST
  from coremltools.models.utils import _is_macos, _macos_version, evaluate_classifier, evaluate_classifier_with_probabilities
label_desc: Use image node_id 3 for calling the BoostedTreeClassificationBostonHousingScikitNumericTest obj's underlying member method code with example usage: obj._train_convert_evaluate_assert() without return types