LaplaceApprox#
- class torch_uncertainty.post_processing.LaplaceApprox(task, model=None, weight_subset='last_layer', hessian_struct='kron', pred_type='glm', link_approx='probit', optimize_prior_precision=True)[source]#
Laplace approximation for uncertainty estimation.
This class is a wrapper of Laplace classes from the laplace-torch library.
- Parameters:
task (
Literal['classification','regression']) – task type.model (
Module|None) – model to be converted.weight_subset (
str) – subset of weights to be considered. Defaults to"last_layer".hessian_struct (
str) – structure of the Hessian matrix. Defaults to"kron".pred_type (
Literal['glm','nn']) – type of posterior predictive, see the Laplace library for more details. Defaults to"glm".link_approx (
Literal['mc','probit','bridge','bridge_norm']) – how to approximate the classification link function for the"glm". See the Laplace library for more details. Defaults to “probit”.optimize_prior_precision (
bool) – whether to optimize the prior precision. Defaults toTrue.
References
[1] Daxberger et al. Laplace Redux - Effortless Bayesian Deep Learning. In NeurIPS 2021.