code: def test_tuner_end_to_end(self):
      train_dataset, test_dataset = testing_utils.get_holdout_data(
          train_samples=128,
          test_samples=64,
          input_shape=(10,),
          num_classes=10,
          random_seed=42,
      )
  
      # TODO: Consider performing `tf.data.Dataset` transformations
      # within get_holdout_data function.
      train_dataset = train_dataset.batch(32)
      test_dataset = test_dataset.batch(32)
  
      def build_model(hp):
          model = tf.keras.Sequential()
          model.add(
              tf.keras.layers.Dense(
                  units=hp.Int(
                      "units", min_value=32, max_value=512, step=32
                  ),
                  activation="relu",
              )
          )
          model.add(tf.keras.layers.Dense(10, activation="softmax"))
          model.compile(
              optimizer=tf.keras.optimizers.Adam(
                  hp.Choice("learning_rate", values=[1e-2, 1e-3, 1e-4])
              ),
              loss="sparse_categorical_crossentropy",
              metrics=["accuracy"],
          )
          return model
  
      # Define phases.
      tuner = tuners.RandomSearch(
          build_model,
          objective="val_accuracy",
          max_trials=3,
          executions_per_trial=1,
          directory=self.test_subdirectory,
          project_name="helloworld_tuner",
          overwrite=True,
      )
  
      tuner_phase = KerasTunerPhase(tuner)
  
      def build_ensemble():
          ensemble = MeanEnsemble(
              submodels=tuner_phase.get_best_models(num_models=2)
          )
          ensemble.compile(
              optimizer=tf.keras.optimizers.Adam(0.01),
              loss="mse",
              metrics=["mae"],
          )
          return [ensemble]
  
      ensemble_phase = KerasTrainerPhase(build_ensemble)
      input_phase = InputPhase(train_dataset, test_dataset)
  
      controller = SequentialController(
          phases=[input_phase, tuner_phase, ensemble_phase]
      )
  
      # Execute phases.
      model_search = ModelSearch(controller)
      model_search.run()
      self.assertIsInstance(
          model_search.get_best_models(num_models=1)[0], MeanEnsemble
      )
  
imports: import os
  import shutil
  import sys
  import time
  from absl import flags
  from absl.testing import parameterized
  from adanet.experimental.controllers.sequential_controller import SequentialController
  from adanet.experimental.keras import testing_utils
  from adanet.experimental.keras.ensemble_model import MeanEnsemble
  from adanet.experimental.keras.model_search import ModelSearch
  from adanet.experimental.phases.autoensemble_phase import AutoEnsemblePhase
  from adanet.experimental.phases.autoensemble_phase import GrowStrategy
  from adanet.experimental.phases.autoensemble_phase import MeanEnsembler
  from adanet.experimental.phases.input_phase import InputPhase
  from adanet.experimental.phases.keras_trainer_phase import KerasTrainerPhase
  from adanet.experimental.phases.keras_tuner_phase import KerasTunerPhase
  from adanet.experimental.phases.repeat_phase import RepeatPhase
  from adanet.experimental.storages.in_memory_storage import InMemoryStorage
  from kerastuner import tuners
  import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling the ModelSearchTest obj's underlying member method code with example usage: obj.test_tuner_end_to_end() and returns: model, list