odatse.algorithm.bayes module#
- class odatse.algorithm.bayes.Algorithm(info: Info, runner: Runner = None, domain=None, run_mode: str = 'initial')[source]#
Bases:
AlgorithmBaseA class to represent the Bayesian optimization algorithm.
- mesh_list#
The mesh grid list.
- Type:
np.ndarray
- label_list#
The list of labels.
- Type:
list[str]
- random_max_num_probes#
The maximum number of random probes.
- Type:
int
- bayes_max_num_probes#
The maximum number of Bayesian probes.
- Type:
int
- score#
The scoring method.
- Type:
str
- interval#
The interval for Bayesian optimization.
- Type:
int
- num_rand_basis#
The number of random basis.
- Type:
int
- xopt#
The optimal solution.
- Type:
np.ndarray
- best_fx#
The list of best function values.
- Type:
list[float]
- best_action#
The list of best actions.
- Type:
list[int]
- fx_list#
The list of function values.
- Type:
list[float]
- param_list#
The list of parameters.
- Type:
list[np.ndarray]
Constructs all the necessary attributes for the Algorithm object.
- Parameters:
info (odatse.Info) – The information object.
runner (odatse.Runner, optional) – The runner object (default is None).
domain (optional) – The domain object (default is None).
run_mode (str, optional) – The run mode (default is “initial”).
- __init__(info: Info, runner: Runner = None, domain=None, run_mode: str = 'initial') None[source]#
Constructs all the necessary attributes for the Algorithm object.
- Parameters:
info (odatse.Info) – The information object.
runner (odatse.Runner, optional) – The runner object (default is None).
domain (optional) – The domain object (default is None).
run_mode (str, optional) – The run mode (default is “initial”).
- _apply_state(data: dict, mode: str = 'resume', restore_rng: bool = True) None[source]#
Restore algorithm state from a checkpoint snapshot.
Delegates MPI validation, timer restore, parameter check, and the instance RNG restore to the base class; additionally restores the global numpy RNG used by physbo, applies the Bayes-specific fields, then loads the physbo policy from the saved files.
_load_state()is not overridden; the base class implementation callsself._apply_state()(this method), so policy files are loaded automatically when resuming from a checkpoint.- Parameters:
data (dict) – Snapshot previously produced by
__getstate__.mode (str) –
"resume"or"continue"; forwarded to the base class. Bayes optimisation does not distinguish between the two modes.restore_rng (bool) – When True (default) both RNG states are restored from data.