blackboxopt.optimizers.staged.hyperband
create_hyperband_iteration(iteration_index, min_fidelity, max_fidelity, eta, config_sampler, objective, logger)
Optimizer specific way to create a new
blackboxopt.optimizer.staged.iteration.StagedIteration
object
Source code in blackboxopt/optimizers/staged/hyperband.py
def create_hyperband_iteration(
iteration_index: int,
min_fidelity: float,
max_fidelity: float,
eta: float,
config_sampler: StagedIterationConfigurationSampler,
objective: Objective,
logger: logging.Logger,
) -> StagedIteration:
"""Optimizer specific way to create a new
`blackboxopt.optimizer.staged.iteration.StagedIteration` object
"""
# 's_max + 1' in the paper
max_num_stages = 1 + int(math.floor(math.log(max_fidelity / min_fidelity, eta)))
# 's+1' in the paper
num_stages = max_num_stages - (iteration_index % (max_num_stages))
num_configs_first_stage = int(
math.ceil((max_num_stages / num_stages) * eta ** (num_stages - 1))
)
num_configs_per_stage = [
int(num_configs_first_stage // (eta**i)) for i in range(num_stages)
]
fidelities_per_stage = [
max_fidelity / eta**i for i in range(num_stages - 1, -1, -1)
]
# Hyperband simple draws random configurations, and there is no additional
# information that needs to be stored
return StagedIteration(
iteration_index,
num_configs_per_stage,
fidelities_per_stage,
config_sampler,
greedy_promotion,
objective,
logger=logger,
)