docstr: Fitting twice with the same config gives the same model params.
  
  This is only valid when the random_state passed is an int. If a
  RandomState object is passed then repeated calls to fit will have
  different results. See the section on "Controlling Randomness" in the
  sklearn docs.
  
  https://scikit-learn.org/0.24/common_pitfalls.html#controlling-randomness
docstr_tok: ["Fitting","twice","with","the","same","config","gives","the","same","model","params",".","This","is","only","valid","when","the","random_state","passed","is","an","int",".","If","a","RandomState","object","is","passed","then","repeated","calls","to","fit","will","have","different","results",".","See","the","section","on","``","Controlling","Randomness","''","in","the","sklearn","docs",".","https",":","\/\/scikit-learn.org\/0.24\/common_pitfalls.html","#","controlling-randomness"]
code: def test_module_idempotent(self):
      """Fitting twice with the same config gives the same model params.
  
      This is only valid when the random_state passed is an int. If a
      RandomState object is passed then repeated calls to fit will have
      different results. See the section on "Controlling Randomness" in the
      sklearn docs.
  
      https://scikit-learn.org/0.24/common_pitfalls.html#controlling-randomness
      """
      if self.__class__ == BaseRegressionComponentTest:
          return
  
      regressor_cls = self.module
  
      X = np.array(
          [
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
          ]
      )
      y = np.array(
          [
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
          ]
      )
  
      # We ignore certain keys when comparing
      param_keys_ignored = ["base_estimator"]
  
      # We use the default config + sampled ones
      configuration_space = (
          regressor_cls.get_hyperparameter_search_space()
      )
  
      default = configuration_space.get_default_configuration()
      sampled = [
          configuration_space.sample_configuration() for _ in range(2)
      ]
  
      for seed, config in enumerate([default] + sampled):
          model_args = {"random_state": seed, **config}
          regressor = regressor_cls(**model_args)
  
          # Get the parameters on the first and second fit with config params
          # Also compare their random state
          with ignore_warnings(regressor_warnings):
              params_first = regressor.fit(
                  X.copy(), y.copy()
              ).estimator.get_params()
  
          if hasattr(regressor.estimator, "random_state"):
              rs_1 = regressor.random_state
              rs_estimator_1 = regressor.estimator.random_state
  
          with ignore_warnings(regressor_warnings):
              params_second = regressor.fit(
                  X.copy(), y.copy()
              ).estimator.get_params()
  
          if hasattr(regressor.estimator, "random_state"):
              rs_2 = regressor.random_state
              rs_estimator_2 = regressor.estimator.random_state
  
          # Remove keys we don't wish to include in the comparison
          for params in [params_first, params_second]:
              for key in param_keys_ignored:
                  if key in params:
                      del params[key]
  
          # They should have equal parameters
          self.assertEqual(
              params_first,
              params_second,
              f"Failed with model args {model_args}",
          )
          if hasattr(
              regressor.estimator, "random_state"
          ) and not isinstance(regressor, LibSVM_SVR):
              # sklearn.svm.SVR has it as an attribute but does not use it and
              # defaults it to None, even if a value is passed in
              assert all(
                  [
                      seed == random_state
                      for random_state in [
                          rs_1,
                          rs_estimator_1,
                          rs_2,
                          rs_estimator_2,
                      ]
                  ]
              )
  
imports: from typing import Container, Type
  import numpy
  import sklearn.metrics
  from autosklearn.pipeline.components.regression import RegressorChoice, _regressors
  from autosklearn.pipeline.components.regression.libsvm_svr import LibSVM_SVR
  from autosklearn.pipeline.constants import SPARSE
  from autosklearn.pipeline.util import _test_regressor, _test_regressor_iterative_fit
  import pytest
  import unittest
  from test.test_pipeline.ignored_warnings import ignore_warnings, regressor_warnings
label_desc: Use image node_id 9 for calling the BaseRegressionComponentTest obj's underlying member method code with example usage: obj.test_module_idempotent() without return types