odatse.algorithm.bayes module

class odatse.algorithm.bayes.Algorithm(info: Info, runner: Runner = None, domain=None, run_mode: str = 'initial')[source]

Bases: AlgorithmBase

A 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”).

_initialize()[source]

Initializes the algorithm parameters and timers.

_load_state(filename, mode='resume', restore_rng=True)[source]

Loads the state of the algorithm from a file.

Parameters:
  • filename (str) – The name of the file to load the state from.

  • mode (str, optional) – The mode to load the state (default is “resume”).

  • restore_rng (bool, optional) – Whether to restore the random number generator state (default is True).

_post() None[source]

Finalizes the algorithm execution and writes the results to a file.

_prepare() None[source]

Prepares the algorithm for execution.

_run() None[source]

Runs the Bayesian optimization process.

_save_state(filename)[source]

Saves the current state of the algorithm to a file.

Parameters:

filename (str) – The name of the file to save the state.