laplace.utils.enums
#
Classes:
-
SubsetOfWeights
–Valid options for
subset_of_weights
. -
HessianStructure
–Valid options for
hessian_structure
. -
Likelihood
–Valid options for
likelihood
. -
PredType
–Valid options for
pred_type
. -
LinkApprox
–Valid options for
link_approx
. -
TuningMethod
–Valid options for the
method
parameter inoptimize_prior_precision
. -
PriorStructure
–Valid options for the
prior_structure
inoptimize_prior_precision
.
SubsetOfWeights
#
Valid options for subset_of_weights
.
Attributes:
-
ALL
–All-layer, all-parameter Laplace.
-
LAST_LAYER
–Last-layer Laplace.
-
SUBNETWORK
–Subnetwork Laplace.
HessianStructure
#
Valid options for hessian_structure
.
Attributes:
Likelihood
#
Valid options for likelihood
.
Attributes:
-
REGRESSION
–Homoskedastic regression, assuming
loss_fn = nn.MSELoss()
. -
CLASSIFICATION
–Classification, assuming
loss_fn = nn.CrossEntropyLoss()
. -
REWARD_MODELING
–Bradley-Terry likelihood, for preference learning / reward modeling.
PredType
#
Valid options for pred_type
.
Attributes:
LinkApprox
#
Valid options for link_approx
.
Only works with likelihood = Likelihood.CLASSIFICATION
.
Attributes:
-
MC
–Monte-Carlo approximation in the function space on top of the GLM predictive.
-
PROBIT
–Closed-form multiclass probit approximation.
-
BRIDGE
–Closed-form Laplace Bridge approximation.
-
BRIDGE_NORM
–Closed-form Laplace Bridge approximation with normalization factor.
BRIDGE_NORM
#
Closed-form Laplace Bridge approximation with normalization factor.
Preferable to BRIDGE
.
TuningMethod
#
Valid options for the method
parameter in optimize_prior_precision
.
Attributes:
-
MARGLIK
–Marginal-likelihood loss via SGD. Does not require validation data.
-
GRIDSEARCH
–Grid search. Requires validation data.
PriorStructure
#
Valid options for the prior_structure
in optimize_prior_precision
.
Attributes:
-
SCALAR
–Scalar prior precision \( \tau I, \tau \in \mathbf{R} \).
-
DIAG
–Scalar prior precision \( \tau \in \mathbb{R}^p \).
-
LAYERWISE
–Layerwise prior precision, i.e. a single scalar prior precision for each block
LAYERWISE
#
Layerwise prior precision, i.e. a single scalar prior precision for each block (corresponding to each the NN's layer) of the diagonal prior-precision matrix..