class_docstr: Test class for first set of voting learner API tests.
docstr: Check that saving models works as expected.
docstr_tok: ["Check","that","saving","models","works","as","expected","."]
code: def check_save_and_load(self, learner_type, use_current_directory):
      """Check that saving models works as expected."""
      # 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"]
          featureset = TRAIN_FS_DIGITS[:100]
      else:
          # otherwise use 3 regressors, the housing training set
          # and pearson as the grid search objective
          learner_names = [
              "LinearRegression",
              "SVR",
              "RandomForestRegressor",
          ]
          featureset = TRAIN_FS_HOUSING[:100]
  
      # instantiate and train a voting learner without grid search
      vl = VotingLearner(learner_names)
      vl.train(featureset, grid_search=False)
  
      # save this trained model into the current directory
      if use_current_directory:
          model_name = Path("test_current_directory.model")
      else:
          model_name = output_dir / "test_other_directory.model"
  
      vl.save(model_name)
  
      # make sure that the model saved and that it's the same model
      self.assertTrue(model_name.exists())
      vl2 = VotingLearner.from_file(model_name)
      self.assertEqual(vl._learner_names, vl2._learner_names)
      self.assertEqual(vl.model_type, vl2.model_type)
      self.assertEqual(vl.voting, vl2.voting)
      self.assertEqual(vl.learner_type, vl2.learner_type)
  
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 16 for calling the TestVotingLearnersAPIOne obj's underlying member method code with example usage: obj.check_save_and_load(learner_type, use_current_directory) without return types