Skip to content

thresholds

Threshold dataclass

merge(other)

Provide a threshold which is always satisfied if both input thresholds are satisfied.

This is generally a less strict threshold than either input.

ThresholdCalibrationCheckpointer

Bases: Checkpointer

Calibrates thresholds to be used by a ValidationCheckpointer.

Does this by recording the minimum and maximum values seen across trials, and using them to derive the maximum relative and absolute error one could have across any pair of trials, then multiplying this by a user-provided factor.

__call__(savepoint_name, **kwargs)

Record values for a savepoint.

Parameters:

Name Type Description Default
savepoint_name SavepointName

name of the savepoint

required
**kwargs ArrayLike

data for the savepoint

{}

__init__(factor=1.0)

Parameters:

Name Type Description Default
factor float

set thresholds equal to this factor of the maximum error seen across trials

1.0

trial()

Context manager for a trial.

A new context manager should entered each time the code being calibrated is called, and exited at the end of code execution. If each of these calls is done with slightly perturbed inputs, this calibrator will be able to estimate an error tolerance for each savepoint call.