docstr: Given a configuration in config, this procedure makes sure that
  the given implementation, which should be a Choice component, honors
  the type of the object, and any hyperparameter associated to it
docstr_tok: ["Given","a","configuration","in","config",",","this","procedure","makes","sure","that","the","given","implementation",",","which","should","be","a","Choice","component",",","honors","the","type","of","the","object",",","and","any","hyperparameter","associated","to","it"]
code: def _test_set_hyperparameter_choice(
      self, expected_key, implementation, config_dict
  ):
      """
      Given a configuration in config, this procedure makes sure that
      the given implementation, which should be a Choice component, honors
      the type of the object, and any hyperparameter associated to it
      """
      keys_checked = [expected_key]
      implementation_type = config_dict[expected_key]
      expected_type = implementation.get_components()[
          implementation_type
      ]
      self.assertIsInstance(implementation.choice, expected_type)
  
      # Are there further hyperparams?
      # A choice component might have attribute requirements that we need to check
      expected_sub_key = (
          expected_key.replace(":__choice__", ":") + implementation_type
      )
      expected_attributes = {}
      if "data_preprocessor:__choice__" in expected_key:
          # We have to check both the numerical and categorical
          to_check = {
              "numerical_transformer": implementation.choice.numer_ppl.named_steps,
              "categorical_transformer": implementation.choice.categ_ppl.named_steps,
              "text_transformer": implementation.choice.txt_ppl.named_steps,
          }
  
          for data_type, pipeline in to_check.items():
              for sub_name, sub_step in pipeline.items():
                  # If it is a Choice, make sure it is the correct one!
                  if isinstance(sub_step, AutoSklearnChoice):
                      key = "data_preprocessor:feature_type:{}:{}:__choice__".format(
                          data_type, sub_name
                      )
                      keys_checked.extend(
                          self._test_set_hyperparameter_choice(
                              key, sub_step, config_dict
                          )
                      )
                  # If it is a component, make sure it has the correct hyperparams
                  elif isinstance(sub_step, AutoSklearnComponent):
                      keys_checked.extend(
                          self._test_set_hyperparameter_component(
                              "data_preprocessor:feature_type:{}:{}".format(
                                  data_type, sub_name
                              ),
                              sub_step,
                              config_dict,
                          )
                      )
                  else:
                      raise ValueError(
                          "New type of pipeline component!"
                      )
          return keys_checked
      else:
          for key, value in config_dict.items():
              if key != expected_key and expected_sub_key in key:
                  expected_attributes[key.split(":")[-1]] = value
                  keys_checked.append(key)
      if expected_attributes:
          attributes = vars(implementation.choice)
          # Cannot check the whole dictionary, just names, as some
          # classes map the text hyperparameter directly to a function!
          for expected_attribute in expected_attributes.keys():
              self.assertIn(expected_attribute, attributes.keys())
      return keys_checked
  
imports: import copy
  import itertools
  import resource
  import tempfile
  import numpy
  import sklearn.datasets
  import sklearn.decomposition
  import sklearn.ensemble
  import sklearn.svm
  from ConfigSpace.configuration_space import ConfigurationSpace
  from ConfigSpace.hyperparameters import CategoricalHyperparameter
  from joblib import Memory
  from sklearn.base import clone
  from sklearn.utils.validation import check_is_fitted
  import autosklearn.pipeline.components.feature_preprocessing
  import autosklearn.pipeline.components.regression
  from autosklearn.pipeline.components.base import AutoSklearnChoice, AutoSklearnComponent, AutoSklearnPreprocessingAlgorithm, AutoSklearnRegressionAlgorithm
  from autosklearn.pipeline.constants import DENSE, PREDICTIONS, SIGNED_DATA, SPARSE, UNSIGNED_DATA
  from autosklearn.pipeline.regression import SimpleRegressionPipeline
  from autosklearn.pipeline.util import get_dataset
  import unittest
  import unittest.mock
  from test.test_pipeline.ignored_warnings import ignore_warnings, regressor_warnings
label_desc: Use image node_id 25 for calling the SimpleRegressionPipelineTest obj's underlying member method code with example usage: obj._test_set_hyperparameter_choice(expected_key, implementation, config_dict) and returns: keys_checked, keys_checked