LMRF#
- class cuqi.distribution.LMRF(location=None, scale=None, bc_type='zero', **kwargs)#
Laplace distribution on the difference between neighboring nodes.
For 1D, the Laplace difference distribution assumes that
\[x_i-x_{i-1} \sim \mathrm{Laplace}(0, b),\]where \(b\) is the scale parameter.
For 2D the differences are defined in both horizontal and vertical directions.
It is possible to define boundary conditions using the bc_type parameter.
The location parameter is a shift of the \(\mathbf{x}\).
- Parameters:
location (scalar or ndarray) – The location parameter of the distribution.
scale (scalar) – The scale parameter of the distribution.
bc_type (string) – The boundary conditions of the difference operator.
Example
import cuqi prior = cuqi.distribution.LMRF(location=0, scale=0.1, geometry=128)
- __init__(location=None, scale=None, bc_type='zero', **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__
([location, scale, bc_type])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.