aiaccel.hpo.algorithms package#

Submodules#

aiaccel.hpo.algorithms.nelder_mead_algorithm module#

class aiaccel.hpo.algorithms.nelder_mead_algorithm.NelderMeadAlgorism(dimensions: int | None = None, coeff: NelderMeadCoefficient | None = None, rng: RandomState | None = None, block: bool = False, timeout: int | None = None)[source]#

Bases: object

Class to manage the NelderMead algorithm

Uses a queue to receive results and advance the NelderMead algorithm. Return parameters within the normalization range by referring only to the number of dimensions.

Parameters:
  • dimensions – int | None = None The number of dimensions in the search space.

  • coeff – NelderMeadCoefficient | None = None Parameters used in NelderMead.

  • rng – np.random.RandomState | None = None RandomState used for calculating initial points.

  • block – bool = False Sets whether to block the queue used internally.

  • timeout – int | None = None Time to block the queue.

vertices#

list[npt.NDArray[np.float64]] List of simplex parameters.

Type:

list[numpy.ndarray[tuple[int, …], numpy.dtype[numpy.float64]]]

values#

list[float] List of simplex calculation results.

Type:

list[float]

generator#

iterator Generator for NelderMead parameters.

lock#

threading.Lock threading.Lock variable used for thread-safe processing.

results#

queue.Queue[tuple[npt.NDArray[np.float64], float, bool]] Queue to receive tuples of parameters, calculation results, and a boolean indicating whether the parameters were output by NelderMead.

simplex_size#

int Number of vertices in the simplex.

get_vertex(dimensions: int | None = None) ndarray[tuple[int, ...], dtype[float64]][source]#

Method to return the next parameters for NelderMead

Thread-safe due to parallel processing requirements.

Returns:

The next parameters for NelderMead.

Return type:

npt.NDArray[np.float64]

put_value(vertex: ndarray[tuple[int, ...], dtype[float64]], value: float, enqueue: bool = False) None[source]#

Method to pass a pair of parameters and results to NelderMead

Parameters:
  • vertex – npt.NDArray[np.float64]: Parameters

  • value – float: Calculation result

  • enqueue – bool = False: Boolean indicating whether the parameters were output by NelderMead.

values: list[float]#
vertices: list[ndarray[tuple[int, ...], dtype[float64]]]#
class aiaccel.hpo.algorithms.nelder_mead_algorithm.NelderMeadCoefficient(r: float = 1.0, ic: float = -0.5, oc: float = 0.5, e: float = 2.0, s: float = 0.5)[source]#

Bases: object

e: float = 2.0#
ic: float = -0.5#
oc: float = 0.5#
r: float = 1.0#
s: float = 0.5#
exception aiaccel.hpo.algorithms.nelder_mead_algorithm.NelderMeadEmptyError[source]#

Bases: Exception

exception aiaccel.hpo.algorithms.nelder_mead_algorithm.UnexpectedVerticesUpdateError(updated_vertices: list[numpy.ndarray[tuple[int, ...], numpy.dtype[numpy.float64]]], updated_values: list[float])[source]#

Bases: Exception

updated_values: list[float]#
updated_vertices: list[ndarray[tuple[int, ...], dtype[float64]]]#

Module contents#

class aiaccel.hpo.algorithms.NelderMeadAlgorism(dimensions: int | None = None, coeff: NelderMeadCoefficient | None = None, rng: RandomState | None = None, block: bool = False, timeout: int | None = None)[source]#

Bases: object

Class to manage the NelderMead algorithm

Uses a queue to receive results and advance the NelderMead algorithm. Return parameters within the normalization range by referring only to the number of dimensions.

Parameters:
  • dimensions – int | None = None The number of dimensions in the search space.

  • coeff – NelderMeadCoefficient | None = None Parameters used in NelderMead.

  • rng – np.random.RandomState | None = None RandomState used for calculating initial points.

  • block – bool = False Sets whether to block the queue used internally.

  • timeout – int | None = None Time to block the queue.

vertices#

list[npt.NDArray[np.float64]] List of simplex parameters.

Type:

list[numpy.ndarray[tuple[int, …], numpy.dtype[numpy.float64]]]

values#

list[float] List of simplex calculation results.

Type:

list[float]

generator#

iterator Generator for NelderMead parameters.

lock#

threading.Lock threading.Lock variable used for thread-safe processing.

results#

queue.Queue[tuple[npt.NDArray[np.float64], float, bool]] Queue to receive tuples of parameters, calculation results, and a boolean indicating whether the parameters were output by NelderMead.

Type:

queue.Queue[tuple[numpy.ndarray[tuple[int, …], numpy.dtype[numpy.float64]], float, bool]]

simplex_size#

int Number of vertices in the simplex.

get_vertex(dimensions: int | None = None) ndarray[tuple[int, ...], dtype[float64]][source]#

Method to return the next parameters for NelderMead

Thread-safe due to parallel processing requirements.

Returns:

The next parameters for NelderMead.

Return type:

npt.NDArray[np.float64]

put_value(vertex: ndarray[tuple[int, ...], dtype[float64]], value: float, enqueue: bool = False) None[source]#

Method to pass a pair of parameters and results to NelderMead

Parameters:
  • vertex – npt.NDArray[np.float64]: Parameters

  • value – float: Calculation result

  • enqueue – bool = False: Boolean indicating whether the parameters were output by NelderMead.

results: Queue[tuple[ndarray[tuple[int, ...], dtype[float64]], float, bool]]#
values: list[float]#
vertices: list[ndarray[tuple[int, ...], dtype[float64]]]#
class aiaccel.hpo.algorithms.NelderMeadCoefficient(r: float = 1.0, ic: float = -0.5, oc: float = 0.5, e: float = 2.0, s: float = 0.5)[source]#

Bases: object

e: float = 2.0#
ic: float = -0.5#
oc: float = 0.5#
r: float = 1.0#
s: float = 0.5#
exception aiaccel.hpo.algorithms.NelderMeadEmptyError[source]#

Bases: Exception