SmoothedLaplace#
- class cuqi.distribution.SmoothedLaplace(location=None, scale=None, beta=0.001, **kwargs)#
Smoothed Laplace distribution.
Defines a smoothed Laplace distribution given a location, a scale and a smoothing parameter beta. The smoothed Laplace distribution is defined as
\[p(x) = \frac{1}{2b} \exp\left(-\frac{\sqrt{(x-\mu)^2 + \beta}}{b}\right),\]where \(\mu\) is the location (mean), \(b\) is the scale (decay) parameter and \(\beta\) is the smoothing parameter.
The rate parameter is defined as \(\lambda = \frac{1}{b}\).
The variables of this Laplace distribution are independent identically distributed (i.i.d.).
- Parameters:
location (scalar, list, tuple, or ndarray) – The location parameter of the distribution.
scale (scalar, list, tuple, or ndarray) – The scale parameter of the distribution.
beta (scalar) – The smoothing parameter of the distribution.
- __init__(location=None, scale=None, beta=0.001, **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, beta])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
(x)Computes the gradient of logpdf at the given values of x.
logd
(*args, **kwargs)Evaluate the un-normalized log density function of the distribution.
logpdf
(x)Computes the logarithm of the probability density function at the given values of x.
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.
Beta parameter
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.
Location parameter
Name of the random variable associated with the density.
Scale parameter