mlos_bench.optimizers.mock_optimizer

Mock optimizer for mlos_bench.

Classes

MockOptimizer

Mock optimizer to test the Environment API.

Module Contents

class mlos_bench.optimizers.mock_optimizer.MockOptimizer(tunables: mlos_bench.tunables.tunable_groups.TunableGroups, config: dict, global_config: dict | None = None, service: mlos_bench.services.base_service.Service | None = None)[source]

Bases: mlos_bench.optimizers.track_best_optimizer.TrackBestOptimizer

Mock optimizer to test the Environment API.

Create a new optimizer for the given configuration space defined by the tunables.

Parameters:
  • tunables (TunableGroups) – The tunables to optimize.

  • config (dict) – Free-format key/value pairs of configuration parameters to pass to the optimizer.

  • global_config (Optional[dict])

  • service (Optional[Service])

bulk_register(configs: Sequence[dict], scores: Sequence[Dict[str, mlos_bench.tunables.tunable.TunableValue] | None], status: Sequence[mlos_bench.environments.status.Status] | None = None) bool[source]

Pre-load the optimizer with the bulk data from previous experiments.

Parameters:
  • configs (Sequence[dict]) – Records of tunable values from other experiments.

  • scores (Sequence[Optional[Dict[str, TunableValue]]]) – Benchmark results from experiments that correspond to configs.

  • status (Optional[Sequence[Status]]) – Status of the experiments that correspond to configs.

Returns:

is_not_empty – True if there is data to register, false otherwise.

Return type:

bool

suggest() mlos_bench.tunables.tunable_groups.TunableGroups[source]

Generate the next (random) suggestion.

Return type:

mlos_bench.tunables.tunable_groups.TunableGroups