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 of searchers, which are components of schedulers responsible for implementing
get_config()
.# TODO: Update docstrings .. note:
This is an abstract base class. In order to implement a new searcher, try to start from :class:`~syne_tune.optimizer.scheduler.searcher.StochasticAndFilterDuplicatesSearcher` or :class:`~syne_tune.optimizer.scheduler.searcher.StochasticSearcher`, which implement generally useful properties.
- Parameters:
config_space (
Dict
[str
,Any
]) – Configuration spacepoints_to_evaluate (
Optional
[List
[Dict
[str
,Any
]]]) – List of configurations to be evaluated initially (in that order). Each config in the list can be partially specified, or even be an empty dict. For each hyperparameter not specified, the default value is determined using a midpoint heuristic. IfNone
(default), this is mapped to[dict()]
, a single default config determined by the midpoint heuristic. If[]
(empty list), no initial configurations are specified.
- 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()