mlos_bench.schedulers package

Interfaces and implementations of the optimization loop scheduling policies.

class mlos_bench.schedulers.Scheduler(*, config: Dict[str, Any], global_config: Dict[str, Any], environment: Environment, optimizer: Optimizer, storage: Storage, root_env_config: str)

Bases: object

Base class for the optimization loop scheduling policies.

Attributes:
max_trials

Gets the maximum number of trials to run for a given experiment, or -1 for no limit.

ran_trials

Get the list of trials that were run.

trial_config_repeat_count

Gets the number of trials to run for a given config.

trial_count

Gets the current number of trials run for the experiment.

Methods

get_best_observation()

Get the best observation from the optimizer.

load_config(config_id)

Load the existing tunable configuration from the storage.

not_done()

Check the stopping conditions.

run_trial(trial)

Set up and run a single trial.

schedule_trial(tunables)

Add a configuration to the queue of trials.

start()

Start the optimization loop.

teardown()

Tear down the environment.

get_best_observation() Tuple[Dict[str, float] | None, TunableGroups | None]

Get the best observation from the optimizer.

load_config(config_id: int) TunableGroups

Load the existing tunable configuration from the storage.

property max_trials: int

Gets the maximum number of trials to run for a given experiment, or -1 for no limit.

not_done() bool

Check the stopping conditions.

By default, stop when the optimizer converges or max limit of trials reached.

property ran_trials: List[Trial]

Get the list of trials that were run.

abstract run_trial(trial: Trial) None

Set up and run a single trial.

Save the results in the storage.

schedule_trial(tunables: TunableGroups) None

Add a configuration to the queue of trials.

abstract start() None

Start the optimization loop.

teardown() None

Tear down the environment.

Call it after the completion of the .start() in the scheduler context.

property trial_config_repeat_count: int

Gets the number of trials to run for a given config.

property trial_count: int

Gets the current number of trials run for the experiment.

class mlos_bench.schedulers.SyncScheduler(*, config: Dict[str, Any], global_config: Dict[str, Any], environment: Environment, optimizer: Optimizer, storage: Storage, root_env_config: str)

Bases: Scheduler

A simple single-threaded synchronous optimization loop implementation.

Attributes:
max_trials

Gets the maximum number of trials to run for a given experiment, or -1 for no limit.

ran_trials

Get the list of trials that were run.

trial_config_repeat_count

Gets the number of trials to run for a given config.

trial_count

Gets the current number of trials run for the experiment.

Methods

get_best_observation()

Get the best observation from the optimizer.

load_config(config_id)

Load the existing tunable configuration from the storage.

not_done()

Check the stopping conditions.

run_trial(trial)

Set up and run a single trial.

schedule_trial(tunables)

Add a configuration to the queue of trials.

start()

Start the optimization loop.

teardown()

Tear down the environment.

run_trial(trial: Trial) None

Set up and run a single trial.

Save the results in the storage.

start() None

Start the optimization loop.

Submodules