class_docstr: Test class for first set of voting learner API tests.
docstr: Run checks when training voting learners.
docstr_tok: ["Run","checks","when","training","voting","learners","."]
code: def check_train(self, learner_type, with_grid_search):
      """Run checks when training voting learners."""
      # if the voting learner is a classifier
      if learner_type == "classifier":
          # use 3 classifiers, the digits training set, and accuracy
          # as the grid search objective
          learner_names = ["LogisticRegression", "SVC", "MultinomialNB"]
          estimator_classes = [LogisticRegression, SVC, MultinomialNB]
          featureset = TRAIN_FS_DIGITS
          objective = "accuracy"
      else:
          # otherwise use 3 regressors, the housing training set
          # and pearson as the grid search objective
          learner_names = [
              "LinearRegression",
              "SVR",
              "RandomForestRegressor",
          ]
          estimator_classes = [
              LinearRegression,
              SVR,
              RandomForestRegressor,
          ]
          featureset = TRAIN_FS_HOUSING
          objective = "pearson"
  
      # instantiate and train a voting learner
      vl = VotingLearner(learner_names)
      vl.train(
          featureset,
          grid_objective=objective,
          grid_search=with_grid_search,
          grid_search_folds=3,
      )
  
      # check that the training worked
      self.assertIsNotNone(vl.model)
      model_type = (
          VotingClassifier
          if learner_type == "classifier"
          else VotingRegressor
      )
      assert isinstance(vl.model, model_type)
  
      # check the underlying learners
      self.assertEqual(len(vl.learners), len(learner_names))
      assert isinstance(vl.learners[0].model, estimator_classes[0])
      assert isinstance(vl.learners[1].model, estimator_classes[1])
      assert isinstance(vl.learners[2].model, estimator_classes[2])
  
      self.assertEqual(len(vl.model.named_estimators_), 3)
      pipeline1 = vl.model.named_estimators_[learner_names[0]]
      pipeline2 = vl.model.named_estimators_[learner_names[1]]
      pipeline3 = vl.model.named_estimators_[learner_names[2]]
  
      assert isinstance(pipeline1, Pipeline)
      assert isinstance(pipeline2, Pipeline)
      assert isinstance(pipeline3, Pipeline)
  
      assert isinstance(pipeline1["estimator"], estimator_classes[0])
      assert isinstance(pipeline2["estimator"], estimator_classes[1])
      assert isinstance(pipeline3["estimator"], estimator_classes[2])
  
imports: import unittest
  from itertools import product
  from pathlib import Path
  import numpy
  from numpy.testing import assert_raises_regex
  from sklearn.ensemble import RandomForestRegressor, VotingClassifier, VotingRegressor
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from sklearn.naive_bayes import MultinomialNB
  from sklearn.pipeline import Pipeline
  from sklearn.svm import SVC, SVR
  from skll.learner.voting import VotingLearner
  from skll.utils.testing import make_california_housing_data, make_digits_data, other_dir, output_dir
label_desc: Use image node_id 12 for calling the TestVotingLearnersAPIOne obj's underlying member method code with example usage: obj.check_train(learner_type, with_grid_search) without return types