class clearml.automation.hpbandster.bandster.OptimizerBOHB

Abstract helper function. Implementation is not required. Default use in process_step default implementation Create a new job if needed. return the newly created job. If no job needs to be created, return None.


A Newly created ClearmlJob object, or None if no ClearmlJob created.


Return a Task IDs dict created by this optimizer until now, including completed and running jobs. The values of the returned dict are the parameters used in the specific job


dict of task IDs (str) as keys, and their parameters dict as values.


Return a Task IDs dict created by this optimizer until now. The values of the returned dict are the ClearmlJob.


dict of task IDs (str) as keys, and their ClearmlJob as values.


Return the metric title, series pair of the objective.


(title, series)

static get_random_seed()

Get the global seed for all hyper-parameter strategy random number sampling.


The random seed.


Return the current running ClearmlJob.


List of ClearmlJob objects.


Return a list of Tasks of the top performing experiments, based on the controller Objective object.


top_k (int) – The number of Tasks (experiments) to return.


A list of Task objects, ordered by performance, where index 0 is the best performing Task.

helper_create_job(base_task_id, parameter_override=None, task_overrides=None, tags=None, parent=None, **kwargs)

Create a Job using the specified arguments, ClearmlJob for details.


A newly created Job instance.


Helper function, Implementation is not required. Default use in process_step default implementation. Check if the job needs to be aborted or already completed.

If returns False, the job was aborted / completed, and should be taken off the current job list

If there is a budget limitation, this call should update self.budget.compute_time.update / self.budget.iterations.update


job (ClearmlJob) – A ClearmlJob object to monitor.


False, if the job is no longer relevant.


Abstract helper function. Implementation is not required. Default use in start default implementation Main optimization loop, called from the daemon thread created by start().

  • Call monitor job on every ClearmlJob in jobs:

    • Check the performance or elapsed time, and then decide whether to kill the jobs.

  • Call create_job:

    • Check if spare job slots exist, and if they do call create a new job based on previous tested experiments.


True, if continue the optimization. False, if immediately stop.


Set the class to use for the helper_create_job() function.


job_class (ClearmlJob) – The Job Class type.

set_job_default_parent(job_parent_task_id, project_name=None)

Set the default parent for all Jobs created by the helper_create_job() method.

  • job_parent_task_id (str) – The parent Task ID.

  • project_name (str) – If specified, create the jobs in the specified project


Set the function used to name a newly created job.


naming_function (callable) –

naming_functor(base_task_name, argument_dict) -> str

set_optimization_args(eta=3, min_budget=None, max_budget=None, min_points_in_model=None, top_n_percent=15, num_samples=None, random_fraction=0.3333333333333333, bandwidth_factor=3, min_bandwidth=0.001)

Defaults copied from BOHB constructor, see details in BOHB.__init__

BOHB performs robust and efficient hyperparameter optimization at scale by combining the speed of Hyperband searches with the guidance and guarantees of convergence of Bayesian Optimization. Instead of sampling new configurations at random, BOHB uses kernel density estimators to select promising candidates.


For reference: @InProceedings{falkner-icml-18,

title = {{BOHB}: Robust and Efficient Hyperparameter Optimization at Scale}, author = {Falkner, Stefan and Klein, Aaron and Hutter, Frank}, booktitle = {Proceedings of the 35th International Conference on Machine Learning}, pages = {1436–1445}, year = {2018},


:param etafloat (3)

In each iteration, a complete run of sequential halving is executed. In it, after evaluating each configuration on the same subset size, only a fraction of 1/eta of them ‘advances’ to the next round. Must be greater or equal to 2.

:param min_budgetfloat (0.01)

The smallest budget to consider. Needs to be positive!

:param max_budgetfloat (1)

The largest budget to consider. Needs to be larger than min_budget! The budgets will be geometrically distributed \(a^2 + b^2 = c^2 /sim /eta^k\) for \(k/in [0, 1, ... , num/_subsets - 1]\).

  • min_points_in_model – int (None) number of observations to start building a KDE. Default ‘None’ means dim+1, the bare minimum.

  • top_n_percent – int (15) percentage ( between 1 and 99, default 15) of the observations that are considered good.

  • num_samples – int (64) number of samples to optimize EI (default 64)

  • random_fraction – float (1/3.) fraction of purely random configurations that are sampled from the prior without the model.

  • bandwidth_factor – float (3.) to encourage diversity, the points proposed to optimize EI, are sampled from a ‘widened’ KDE where the bandwidth is multiplied by this factor (default: 3)

  • min_bandwidth – float (1e-3) to keep diversity, even when all (good) samples have the same value for one of the parameters, a minimum bandwidth (Default: 1e-3) is used instead of zero.


Set the optimizer task object to be used to store/generate reports on the optimization process. Usually this is the current task of this process.


task (Task) – The optimizer`s current Task.

static set_random_seed(seed=1337)

Set global seed for all hyper-parameter strategy random number sampling.


seed (int) – The random seed.


Start the Optimizer controller function loop() If the calling process is stopped, the controller will stop as well.


This function returns only after optimization is completed or stop() was called.


Stop the current running optimization loop, Called from a different thread than the start().