mxfusion.components.distributions.laplace

Members

class mxfusion.components.distributions.laplace.Laplace(location, scale, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.univariate.UnivariateDistribution

The one-dimensional Laplace distribution. The Laplace distribution can be defined over a scalar random variable or an array of random variables. In case of an array of random variables, the location and scale are broadcasted to the shape of the output random variable (array).

Parameters:
  • location (Variable) – Location of the Laplace distribution.
  • scale (Variable) – Scale of the Laplace distribution.
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
log_pdf_impl(location, scale, random_variable, F=None)

Computes the logarithm of the probability density function (PDF) of the Laplace distribution.

Parameters:
  • location (MXNet NDArray or MXNet Symbol) – the location of the Laplace distribution.
  • scale (MXNet NDArray or MXNet Symbol) – the scale of the Laplace distributions.
  • random_variable (MXNet NDArray or MXNet Symbol) – the random variable of the Laplace distribution.
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:

log pdf of the distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

draw_samples_impl(location, scale, rv_shape, num_samples=1, F=None)

Draw samples from the Laplace distribution.

Parameters:
  • location (MXNet NDArray or MXNet Symbol) – the location of the Laplace distribution.
  • scale (MXNet NDArray or MXNet Symbol) – the scale of the Laplace distributions.
  • rv_shape (tuple) – the shape of each sample.
  • num_samples (int) – the number of drawn samples (default: one).
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:

a set samples of the Laplace distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

static define_variable(location=0.0, scale=1.0, shape=None, rand_gen=None, dtype=None, ctx=None)

Creates and returns a random variable drawn from a Laplace distribution.

Parameters:
  • location – Location of the distribution.
  • scale – Scale of the distribution.
  • shape (tuple or [tuple]) – the shape of the random variable(s).
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
Returns:

the random variables drawn from the Laplace distribution.

Rtypes:

Variable