syne_tune.optimizer.schedulers.searchers.searcher module
- class syne_tune.optimizer.schedulers.searchers.searcher.BaseSearcher(config_space, points_to_evaluate=None, random_seed=None)[source]
Bases:
object
Base class for searchers that sample hyperparameter configurations from the given configuration space.
- Parameters:
config_space (
Dict
[str
,Any
]) – The configuration space to sample from.points_to_evaluate (
Optional
[List
[Dict
[str
,Any
]]]) – A list of configurations to evaluate initially (in the given order).random_seed (
Optional
[int
]) – Seed used to initialize the random number generators.
- suggest(**kwargs)[source]
Suggest a new configuration.
Note: Query
_next_points_to_evaluate()
for initial configs to return first.- Parameters:
kwargs – Extra information may be passed from scheduler to searcher
- Return type:
Optional
[Dict
[str
,Any
]]- Returns:
New configuration. The searcher may return None if a new configuration cannot be suggested. In this case, the tuning will stop. This happens if searchers never suggest the same config more than once, and all configs in the (finite) search space are exhausted.
- on_trial_result(trial_id, config, metrics)[source]
Inform searcher about result
The scheduler passes every result. If
update == True
, the searcher should update its surrogate model (if any), otherwiseresult
is an intermediate result not modelled.The default implementation calls
_update()
ifupdate == True
. It can be overwritten by searchers which also react to intermediate results.- Parameters:
trial_id (
int
) – Seeon_trial_result()
config (
Dict
[str
,Any
]) – Seeon_trial_result()
metrics (
List
[float
]) – Seeon_trial_result()
- on_trial_error(trial_id)[source]
Called by scheduler if an evaluation job for a trial failed.
The searcher should react appropriately (e.g., remove pending evaluations for this trial, not suggest the configuration again).
- Parameters:
trial_id (
int
) – ID of trial whose evaluated failed
- on_trial_complete(trial_id, config, metrics)[source]
Inform searcher about result
The scheduler passes every result. If
update == True
, the searcher should update its surrogate model (if any), otherwiseresult
is an intermediate result not modelled.The default implementation calls
_update()
ifupdate == True
. It can be overwritten by searchers which also react to intermediate results.- Parameters:
trial_id (
int
) – Seeon_trial_result()
config (
Dict
[str
,Any
]) – Seeon_trial_result()
metrics (
List
[float
]) – Seeon_trial_result()