class_docstr: A phase that automatically ensembles models from a prior phase.
code: def work_units(self, previous_phase) -> Iterator[WorkUnit]:
      self._train_dataset = previous_phase.get_train_dataset()
      self._eval_dataset = previous_phase.get_eval_dataset()
      if self._num_candidates:
          candidates = previous_phase.get_best_models(
              num_models=self._num_candidates
          )
      else:
          candidates = previous_phase.get_models()
      if self.get_best_models():
          current_best_ensemble = list(self.get_best_models())[0]
      else:
          current_best_ensemble = None
  
      for ensemble_strategy in self._ensemble_strategies:
          for submodels in ensemble_strategy(candidates):
              for ensembler in self._ensemblers:
                  if current_best_ensemble:
                      previous_ensemble = (
                          current_best_ensemble.submodels
                      )
                  else:
                      previous_ensemble = []
                  ensemble = ensembler(previous_ensemble + submodels)
                  yield KerasTrainerWorkUnit(
                      ensemble,
                      previous_phase.get_train_dataset(),
                      previous_phase.get_eval_dataset(),
                      self._storage,
                  )
  
imports: import abc
  import random
  from typing import Iterable, Iterator, List
  from adanet.experimental.keras.ensemble_model import EnsembleModel
  from adanet.experimental.keras.ensemble_model import MeanEnsemble
  from adanet.experimental.phases.phase import DatasetProvider
  from adanet.experimental.phases.phase import ModelProvider
  from adanet.experimental.storages.in_memory_storage import InMemoryStorage
  from adanet.experimental.storages.storage import Storage
  from adanet.experimental.work_units.keras_trainer_work_unit import KerasTrainerWorkUnit
  from adanet.experimental.work_units.work_unit import WorkUnit
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the AutoEnsemblePhase obj's underlying member method code with example usage: obj.work_units(previous_phase) without return types