Skip to content

Callbacks: keras_proba.callbacks

Training callbacks.

ResetCovarianceCallback

Bases: keras.src.callbacks.callback.Callback

Resets the precision matrix of every GP covariance layer at the start of each epoch.

RandomFeatureGaussianProcess accumulates its posterior precision matrix over training minibatches. Since the feature extractor changes during training, the estimate should be recomputed in each epoch, so that the final covariance only reflects the last epoch's features [1].

Example:

model.fit(x, y, epochs=10, callbacks=[ResetCovarianceCallback()])

[1]: Jeremiah Liu et al. Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awareness. In Neural Information Processing Systems, 2020. https://arxiv.org/abs/2006.10108

__doc__ class-attribute

__doc__ = "Resets the precision matrix of every GP covariance layer at the start of each epoch.\n\n    `RandomFeatureGaussianProcess` accumulates its posterior precision matrix\n    over training minibatches. Since the feature extractor changes during\n    training, the estimate should be recomputed in each epoch, so that the\n    final covariance only reflects the last epoch's features [1].\n\n    Example:\n\n    ```python\n    model.fit(x, y, epochs=10, callbacks=[ResetCovarianceCallback()])\n    ```\n\n    [1]: Jeremiah Liu et al. Simple and Principled Uncertainty Estimation with\n         Deterministic Deep Learning via Distance Awareness.\n         In _Neural Information Processing Systems_, 2020.\n         https://arxiv.org/abs/2006.10108\n    "

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'keras_proba.callbacks.reset_covariance'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.