Index

PhiUpdaterABC(phi, gamma, a_target, func, …) A class for applying and updating \(\phi\).
PhiUpdater([phi, gamma, a_target, func]) A class for applying and updating \(\phi\).

API

class FOX.armc.PhiUpdaterABC(phi, gamma, a_target, func, **kwargs)[source]

A class for applying and updating \(\phi\).

Has two main methods:

  • __call__() for applying phi to the passed value.
  • update() for updating the value of phi.

Examples

>>> import numpy as np

>>> value = np.ndarray(...)
>>> phi = PhiUpdater(...)

>>> phi(value)
>>> phi.update(...)
phi

The variable \(\phi\).

Type:np.ndarray[np.float64]
gamma

The constant \(\gamma\).

Type:np.ndarray[np.float64]
a_target

The target acceptance rate \(\alpha_{t}\).

Type:np.ndarray[np.float64]
func

The callable used for applying \(\phi\) to the auxiliary error. The callable should take an array-like object and a numpy.ndarray as arguments and return a new array.

Type:Callable[[array-like, ndarray], ndarray]
property shape

Return the shape of phi.

Serves as a wrapper around the shape attribute of phi. Note that phi, gamma and a_target all have the same shape.

to_yaml_dict()[source]

Convert this instance into a .yaml-compatible dictionary.

abstract update(acceptance, **kwargs)[source]

An abstract method for updating phi based on the values of gamma and acceptance.

Parameters:
  • acceptance (ArrayLike[np.bool_]) – An array-like object consisting of booleans.
  • **kwargs (Any) – Further keyword arguments which can be customized in the methods of subclasses.
class FOX.armc.PhiUpdater(phi=1.0, gamma=2.0, a_target=0.25, func=<ufunc 'add'>, **kwargs)[source]

A class for applying and updating \(\phi\).

Has two main methods:

  • __call__() for applying phi to the passed value.
  • update() for updating the value of phi.

Examples

>>> import numpy as np

>>> value = np.ndarray(...)
>>> phi = PhiUpdater(...)

>>> phi(value)
>>> phi.update(...)
phi

The variable \(\phi\).

Type:np.ndarray[np.float64]
gamma

The constant \(\gamma\).

Type:np.ndarray[np.float64]
a_target

The target acceptance rate \(\alpha_{t}\).

Type:np.ndarray[np.float64]
func

The callable used for applying \(\phi\) to the auxiliary error. The callable should take an array-like object and a numpy.ndarray as arguments and return a new array.

Type:Callable[[array-like, ndarray], ndarray]
update(acceptance, *, logger=None)[source]

Update the variable \(\phi\).

\(\phi\) is updated based on the target accepatance rate, \(\alpha_{t}\), and the acceptance rate, acceptance, of the current super-iteration:

\[\phi_{\kappa \omega} = \phi_{ ( \kappa - 1 ) \omega} * \gamma^{ \text{sgn} ( \alpha_{t} - \overline{\alpha}_{ ( \kappa - 1 ) }) }\]
Parameters: