The Master – the brains of HpBandster

class hpbandster.core.master.Master(run_id, config_generator, working_directory='.', ping_interval=60, nameserver='127.0.0.1', nameserver_port=None, host=None, shutdown_workers=True, job_queue_sizes=(-1, 0), dynamic_queue_size=True, logger=None, result_logger=None, previous_result=None)[source]

The Master class is responsible for the book keeping and to decide what to run next. Optimizers are instantiations of Master, that handle the important steps of deciding what configurations to run on what budget when.

Parameters:
  • run_id (string) – A unique identifier of that Hyperband run. Use, for example, the cluster’s JobID when running multiple concurrent runs to separate them
  • config_generator (hpbandster.config_generators object) – An object that can generate new configurations and registers results of executed runs
  • working_directory (string) – The top level working directory accessible to all compute nodes(shared filesystem).
  • eta (float) – 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.
  • min_budget (float) – The smallest budget to consider. Needs to be positive!
  • max_budget (float) – the largest budget to consider. Needs to be larger than min_budget! The budgets will be geometrically distributed \(\sim \eta^k\) for \(k\in [0, 1, ... , num\_subsets - 1]\).
  • ping_interval (int) – number of seconds between pings to discover new nodes. Default is 60 seconds.
  • nameserver (str) – address of the Pyro4 nameserver
  • nameserver_port (int) – port of Pyro4 nameserver
  • host (str) – ip (or name that resolves to that) of the network interface to use
  • shutdown_workers (bool) – flag to control whether the workers are shutdown after the computation is done
  • job_queue_size (tuple of ints) – min and max size of the job queue. During the run, when the number of jobs in the queue reaches the min value, it will be filled up to the max size. Default: (0,1)
  • dynamic_queue_size (bool) – Whether or not to change the queue size based on the number of workers available. If true (default), the job_queue_sizes are relative to the current number of workers.
  • logger (logging.logger like object) – the logger to output some (more or less meaningful) information
  • result_logger (hpbandster.api.results.util.json_result_logger object) – a result logger that writes live results to disk
  • previous_result (hpbandster.core.result.Result object) – previous run to warmstart the run
active_iterations()[source]

function to find active (not marked as finished) iterations

Returns:list
Return type:all active iteration objects (empty if there are none)
adjust_queue_size(number_of_workers=None)[source]
get_next_iteration(iteration, iteration_kwargs)[source]

instantiates the next iteration

Overwrite this to change the iterations for different optimizers

Parameters:
  • iteration (int) – the index of the iteration to be instantiated
  • iteration_kwargs (dict) – additional kwargs for the iteration class
Returns:

HB_iteration

Return type:

a valid HB iteration object

job_callback(job)[source]

method to be called when a job has finished

this will do some book keeping and call the user defined new_result_callback if one was specified

run(n_iterations=1, min_n_workers=1, iteration_kwargs={})[source]
run n_iterations of SuccessiveHalving
Parameters:
  • n_iterations (int) – number of iterations to be performed in this run
  • min_n_workers (int) – minimum number of workers before starting the run
shutdown(shutdown_workers=False)[source]
wait_for_workers(min_n_workers=1)[source]

helper function to hold execution until some workers are active

Parameters:min_n_workers (int) – minimum number of workers present before the run starts