syne_tune.optimizer.schedulers.synchronous.hyperband_bracket_manager module

class syne_tune.optimizer.schedulers.synchronous.hyperband_bracket_manager.SynchronousHyperbandBracketManager(bracket_rungs, mode)[source]

Bases: object

Maintains all brackets, relays requests for another job and report of result to one of the brackets.

Each bracket contains a number of rungs, the largest one max_num_rungs. A bracket with k rungs has offset max_num_rungs - k. Hyperband cycles through brackets with offset 0, ..., num_brackets - 1, where num_brackets <= max_num_rungs.

At any given time, one bracket is primary, all other active brackets are secondary. Jobs are preferentially assigned to the primary bracket, but if its current rung has no free slots (all are pending), secondary brackets are considered.

Each bracket has a bracket_id (nonnegative int). The primary bracket always has the lowest id of all active ones. For job assignment, we iterate over active brackets starting from the primary, and assign the job to the first bracket which has a free slot. If none of the active brackets have a free slot, a new bracket is created.

Parameters:
  • bracket_rungs (List[List[Tuple[int, int]]]) – Rungs for successive brackets, from largest to smallest

  • mode (str) – Criterion is minimized (‘min’) or maximized (‘max’)

property bracket_rungs: List[List[Tuple[int, int]]]
level_to_prev_level(bracket_id, level)[source]
Parameters:
  • bracket_id (int) –

  • level (int) – Level in bracket

Return type:

int

Returns:

Previous level; or 0

next_job()[source]

Called by scheduler to request a new job. Jobs are preferentially assigned to the primary bracket, which has the lowest id among all active brackets. If the primary bracket does not accept jobs (because all remaining slots are already pending), further active brackets are polled. If none of the active brackets accept jobs, a new bracket is created.

The job description returned is (bracket_id, slot_in_rung), where slot_in_rung is SlotInRung, containing the info of what is to be done (trial_id, level fields). It is this entry which has to be returned in ‘on_result``, which the metric_val field set. If the job returned here has trial_id == None, it comes from the lowest rung of its bracket, and the trial_id has to be set as well when returning the record in on_result.

Return type:

Tuple[int, SlotInRung]

Returns:

Tuple (bracket_id, slot_in_rung)

on_result(result)[source]

Called by scheduler to provide result for previously requested job. See next_job().

Parameters:

result (Tuple[int, SlotInRung]) – Tuple (bracket_id, slot_in_rung)

Return type:

Optional[List[int]]

Returns:

See on_result()