quri_parts.algo.optimizer.tolerance module#

quri_parts.algo.optimizer.tolerance.ftol(ftol: float) Callable[[float, float], bool]#

Returns a function evaluating cost function tolerance.

The return value is True when the cost function difference is less than ftol; specifically |cost_prev - cost| <= 0.5 * ftol * (|cost_prev| + |cost|) + 1e-20.

quri_parts.algo.optimizer.tolerance.gtol(gtol: float) Callable[[npt.NDArray[np.float_]], bool]#

Returns a function evaluating gradient function tolerance.

The return value is True when amax(abs(grad)) <= gtol.