Cauchy#

class cuqi.distribution.Cauchy(location=None, scale=None, is_symmetric=True, **kwargs)#

Multivariate Cauchy distribution of independent random variables.

Each is distributed according to the PDF function

\[\frac{1}{\pi\gamma(1+\frac{(x-\mu)^2}{\gamma^2})}\]

where \(\mu\) is the location parameter and \(\gamma\) is the scale parameter.

Parameters:
  • location (float or array_like) – Location parameter

  • scale (float or array_like) – Scale parameter

Example

# % Generate a Cauchy distribution
import cuqi
location = 0
scale  = 1
x = cuqi.distribution.Cauchy(location, scale)
x.logpdf(0) # -1.1447298858494002
# % Generate a multivariate Cauchy distribution
import cuqi
location = [0, 1]
scale  = [1, 3]
x = cuqi.distribution.Cauchy(location, scale)
x.logpdf([0, 0]) # -3.4934325760247367
__init__(location=None, scale=None, is_symmetric=True, **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, is_symmetric])

Initialize the core properties of the distribution.

cdf(x)

disable_FD()

Disable finite difference approximation for logd gradient.

enable_FD([epsilon])

Enable finite difference approximation for logd gradient.

get_conditioning_variables()

Return the conditioning variables of this distribution (if any).

get_mutable_variables()

Return any public variable that is mutable (attribute or property) except those in the ignore_vars list

get_parameter_names()

Returns the names of the parameters that the density can be evaluated at or conditioned on.

gradient(x)

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

FD_enabled

Returns True if finite difference approximation of the logd gradient is enabled.

FD_epsilon

Spacing for the finite difference approximation of the logd gradient.

dim

Return the dimension of the distribution based on the geometry.

geometry

Return the geometry of the distribution.

is_cond

Returns True if instance (self) is a conditional distribution.

location

Location parameter

name

Name of the random variable associated with the density.

scale

Scale parameter