syne_tune.optimizer.schedulers.synchronous.hyperband_bracket module
- class syne_tune.optimizer.schedulers.synchronous.hyperband_bracket.SlotInRung(rung_index, level, slot_index, trial_id, metric_val)[source]
Bases:
object
Used to communicate slot positions and content for them.
-
rung_index:
int
-
level:
int
-
slot_index:
int
-
trial_id:
Optional
[int
]
-
metric_val:
Optional
[float
]
-
rung_index:
- class syne_tune.optimizer.schedulers.synchronous.hyperband_bracket.SynchronousBracket(mode)[source]
Bases:
object
Base class for a single bracket in synchronous Hyperband algorithms.
A bracket consists of a list of rungs. Each rung consists of a number of slots and a resource level (called rung level). The larger the rung level, the smaller the number of slots.
A slot is occupied (by a metric value), free, or pending. A pending slot has already been returned by
next_free_slot()
. Slots in the lowest rung (smallest rung level, largest size) are filled first. At any point in time, only slots in the lowest not fully occupied rung can be filled. If there are no free slots in the current rung, but there are pending ones, the bracket is blocked, and another bracket needs to be worked on.- property num_rungs: int
- num_pending_slots()[source]
- Return type:
int
- Returns:
Number of pending slots (have been returned by
next_free_slot
, but not yet occupied
- next_free_slot()[source]
- Return type:
Optional
[SlotInRung
]
- on_result(result)[source]
Provides result for slot previously requested by
next_free_slot
. Here,result.metric
is written to the slot in order to make it occupied. Also,result.trial_id
is written there.We normally return
None
. But if the result passed completes the current rung, this triggers the creation of a child run which consists of promoted trials from the current rung. In this case, we return the IDs of trials which have not been promoted. This is used in for early removal of checkpoints, seetrials_checkpoints_can_be_removed()
.- Parameters:
result (
SlotInRung
) – See above- Return type:
Optional
[List
[int
]]- Returns:
See above
- class syne_tune.optimizer.schedulers.synchronous.hyperband_bracket.SynchronousHyperbandBracket(rungs, mode)[source]
Bases:
SynchronousBracket
Represents a bracket in standard synchronous Hyperband.
When a rung is fully occupied, slots for the next rung are assigned with the trial_id’s having the best metric values. At any point in time, only slots in the lowest not fully occupied rung can be filled.
- property num_rungs: int
- syne_tune.optimizer.schedulers.synchronous.hyperband_bracket.get_top_list(rung, new_len, mode)[source]
Returns list of IDs of trials of len
new_len
which should be promoted, because they performed best. We also return the list of IDs of the remaining trials, which are not to be promoted.- Parameters:
rung (
List
[Tuple
[int
,float
]]) – Current rung which has just been completednew_len (
int
) – Size of new rungmode (
str
) – “min” or “max”
- Return type:
(
List
[int
],List
[int
])- Returns:
(top_list, remaining_list)