class_docstr: Test class for regression tests.
code: def check_linear_models(
      self, name, use_feature_hashing=False, use_rescaling=False
  ):
      # create a FeatureSet object with the data we want to use
      if use_feature_hashing:
          (train_fs, test_fs, weightdict) = make_regression_data(
              num_examples=5000,
              num_features=10,
              use_feature_hashing=True,
              feature_bins=5,
          )
      else:
          train_fs, test_fs, weightdict = make_regression_data(
              num_examples=2000, num_features=3
          )
  
      # create the learner
      model_kwargs = (
          {}
          if name in ["BayesianRidge", "Lars", "LinearRegression"]
          else {"max_iter": 500}
      )
      name = f"Rescaled{name}" if use_rescaling else name
      learner = Learner(name, model_kwargs=model_kwargs)
  
      # train it with the training feature set we created
      # make sure to set the grid objective to pearson
      learner.train(
          train_fs, grid_search=True, grid_objective="pearson"
      )
  
      # make sure that the weights are close to the weights
      # that we got from make_regression_data. Take the
      # ceiling before comparing since just comparing
      # the ceilings should be enough to make sure nothing
      # catastrophic happened. However, sometimes with
      # feature hashing, the ceiling is not exactly identical
      # so when that fails we want to check that the rounded
      # feature values are the same. One of those two equalities
      # _must_ be satisified.
  
      # get the weights for this trained model
      learned_weights = learner.model_params[0]
  
      for feature_name in learned_weights:
          learned_w_ceil = math.ceil(learned_weights[feature_name])
          given_w_ceil = math.ceil(weightdict[feature_name])
          learned_w_round = round(learned_weights[feature_name], 0)
          given_w_round = round(weightdict[feature_name], 0)
          ceil_equal = learned_w_ceil == given_w_ceil
          round_equal = learned_w_round == given_w_round
          either_equal = ceil_equal or round_equal
          assert either_equal
  
      # now generate the predictions on the test FeatureSet
      predictions = learner.predict(test_fs)
  
      # now make sure that the predictions are close to
      # the actual test FeatureSet labels that we generated
      # using make_regression_data. To do this, we just
      # make sure that they are correlated with pearson > 0.95
      cor, _ = pearsonr(predictions, test_fs.labels)
      self.assertGreater(cor, 0.95)
  
imports: import math
  import re
  import unittest
  import warnings
  from itertools import chain, product
  import numpy
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy.stats import pearsonr
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from skll.config import _setup_config_parser
  from skll.data import FeatureSet, NDJReader, NDJWriter
  from skll.experiments import run_configuration
  from skll.learner import Learner
  from skll.learner.utils import rescaled
  from skll.utils.constants import CLASSIFICATION_ONLY_METRICS
  from skll.utils.testing import config_dir, fill_in_config_paths_for_fancy_output, make_regression_data, other_dir, output_dir, test_dir, train_dir, unlink
label_desc: Use image node_id 5 for calling the TestRegression obj's underlying member method code with example usage: obj.check_linear_models(name, use_feature_hashing, use_rescaling) without return types