RegularizedGaussian#
- class cuqi.implicitprior.RegularizedGaussian(mean=None, cov=None, prec=None, sqrtcov=None, sqrtprec=None, proximal=None, projector=None, constraint=None, regularization=None, **kwargs)#
Implicit Regularized Gaussian.
Defines a so-called implicit prior based on a Gaussian distribution with implicit regularization. The regularization can be defined in the form of a proximal operator or a projector. Alternatively, preset constraints and regularization can be used.
Precisely one of proximal, projector, constraint or regularization needs to be provided. Otherwise, an error is raised.
Can be used as a prior in a posterior which can be sampled with the RegularizedLinearRTO sampler.
For more details on implicit regularized Gaussian see the following paper:
[1] Everink, Jasper M., Yiqiu Dong, and Martin S. Andersen. “Sparse Bayesian inference with regularized Gaussian distributions.” Inverse Problems 39.11 (2023): 115004.
- Parameters:
mean – See
Gaussian
for details.cov – See
Gaussian
for details.prec – See
Gaussian
for details.sqrtcov – See
Gaussian
for details.sqrtprec – See
Gaussian
for details.proximal (callable f(x, scale) or None) – Euclidean proximal operator f of the regularization function g, that is, a solver for the optimization problem min_z 0.5||x-z||_2^2+scale*g(x).
- projectorcallable f(x) or None
Euclidean projection onto the constraint C, that is, a solver for the optimization problem min_(z in C) 0.5||x-z||_2^2.
- constraintstring or None
Preset constraints. Can be set to “nonnegativity” and “box”. Required for use in Gibbs. For “box”, the following additional parameters can be passed:
- lower_boundarray_like or None
Lower bound of box, defaults to zero
- upper_boundarray_like
Upper bound of box, defaults to one
- regularizationstring or None
Preset regularization. Can be set to “l1”. Required for use in Gibbs in future update. For “l1”, the following additional parameters can be passed:
- strengthscalar
Regularization parameter, i.e., strength*||x||_1 , defaults to one
- __init__(mean=None, cov=None, prec=None, sqrtcov=None, sqrtprec=None, proximal=None, projector=None, constraint=None, regularization=None, **kwargs)#
Initialize the core properties of the distribution.
- Parameters:
name (str, default None) – Name of distribution.
geometry (Geometry, default _DefaultGeometry (or None)) – Geometry of distribution.
is_symmetric (bool, default None) – Indicator if distribution is symmetric.
Methods
__init__
([mean, cov, prec, sqrtcov, ...])Initialize the core properties of the distribution.
Disable finite difference approximation for logd gradient.
enable_FD
([epsilon])Enable finite difference approximation for logd gradient.
Return the conditioning variables of this distribution (if any).
Return any public variable that is mutable (attribute or property) except those in the ignore_vars list
Returns the names of the parameters that the density can be evaluated at or conditioned on.
gradient
(*args, **kwargs)Returns the gradient of the log density at x.
logd
(*args, **kwargs)Evaluate the un-normalized log density function of the distribution.
logpdf
(x)Evaluate the log probability density function of the distribution.
pdf
(x)Evaluate the log probability density function of the distribution.
sample
([N])Sample from the distribution.
to_likelihood
(data)Convert conditional distribution to a likelihood function given observed data
Attributes
Returns True if finite difference approximation of the logd gradient is enabled.
Spacing for the finite difference approximation of the logd gradient.
Return the dimension of the distribution based on the geometry.
Return the geometry of the distribution.
Returns True if instance (self) is a conditional distribution.
Name of the random variable associated with the density.