IterationHistory#

Note

The iteration_history of a BADS object holds the incumbent at the end of each iteration of its run.

Its timer holds, at the end of each iteration, the seconds that the run has spent so far in each of its stages and in the target’s evaluations, a record for PyBADS’s developer tools whose format can change in any release.

In a noisy run, the fval and fsd of every past iterate are re-estimated at the end of each iteration and of the run, so the recorded values of earlier iterations change as the run goes on. A past iterate whose re-estimate fails holds NaN for both and is not returned as the solution; the result’s fval and fsd are finite.

class pybads.utils.IterationHistory(keys: list)[source]#

This class is responsible for storing the history information for each iteration of PyBADS.

Parameters:
keyslist

The keys that can be recorded with this object.

record(key: str, value: object, iteration: int)[source]#

Store a value for a key in a given iteration.

Parameters:
keystr

The key for which the value should be stored.

valueobject

The value which should be stored.

iterationint

The iteration for which the value should be stored, must be >= 0.

Raises:
ValueError

Raised if the value of the iteration is < 0.

ValueError

Raised if a key has not been specified on initialization of the object.

record_iteration(key_value: dict, iteration: int)[source]#

Convenience method to record multiple key-values for a given iteration.

Parameters:
key_valuedict

The keys and values that should be recorded. They keys must have been specified on initialization of the object.

iterationint

The iteration for which the value should be stored, must be >= 0.

Raises:
ValueError

Raised if the value of the iteration is < 0.

ValueError

Raised if a key has not been specified on initialization of the object