mlpack
Public Member Functions | List of all members
mlpack::distribution::LaplaceDistribution Class Reference

The multivariate Laplace distribution centered at 0 has pdf. More...

#include <laplace_distribution.hpp>

Public Member Functions

 LaplaceDistribution ()
 Default constructor, which creates a Laplace distribution with zero dimension and zero scale parameter.
 
 LaplaceDistribution (const size_t dimensionality, const double scale)
 Construct the Laplace distribution with the given scale and dimensionality. More...
 
 LaplaceDistribution (const arma::vec &mean, const double scale)
 Construct the Laplace distribution with the given mean and scale parameter. More...
 
size_t Dimensionality () const
 Return the dimensionality of this distribution.
 
double Probability (const arma::vec &observation) const
 Return the probability of the given observation. More...
 
void Probability (const arma::mat &x, arma::vec &probabilities) const
 Evaluate probability density function of given observation. More...
 
double LogProbability (const arma::vec &observation) const
 Return the log probability of the given observation. More...
 
void LogProbability (const arma::mat &x, arma::vec &logProbabilities) const
 Evaluate log probability density function of given observation. More...
 
arma::vec Random () const
 Return a randomly generated observation according to the probability distribution defined by this object. More...
 
void Estimate (const arma::mat &observations)
 Estimate the Laplace distribution directly from the given observations. More...
 
void Estimate (const arma::mat &observations, const arma::vec &probabilities)
 Estimate the Laplace distribution from the given observations, taking into account the probability of each observation actually being from this distribution. More...
 
const arma::vec & Mean () const
 Return the mean.
 
arma::vec & Mean ()
 Modify the mean.
 
double Scale () const
 Return the scale parameter.
 
double & Scale ()
 Modify the scale parameter.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the distribution.
 

Detailed Description

The multivariate Laplace distribution centered at 0 has pdf.

\[ f(x|\theta) = \frac{1}{2 \theta}\exp\left(-\frac{\|x - \mu\|}{\theta}\right) \]

given scale parameter \(\theta\) and mean \(\mu\). This implementation assumes a diagonal covariance, but a rewrite to support arbitrary covariances is possible.

See the following paper for more information on the non-diagonal-covariance Laplace distribution and estimation techniques:

@article{eltoft2006multivariate,
title={{On the Multivariate Laplace Distribution}},
author={Eltoft, Torbj\orn and Kim, Taesu and Lee, Te-Won},
journal={IEEE Signal Processing Letters},
volume={13},
number={5},
pages={300--304},
year={2006}
}

Note that because of the diagonal covariance restriction, much of the algebra in the paper above becomes simplified, and the PDF takes roughly the same form as the univariate case.

Constructor & Destructor Documentation

◆ LaplaceDistribution() [1/2]

mlpack::distribution::LaplaceDistribution::LaplaceDistribution ( const size_t  dimensionality,
const double  scale 
)
inline

Construct the Laplace distribution with the given scale and dimensionality.

The mean is initialized to zero.

Parameters
dimensionalityDimensionality of distribution.
scaleScale of distribution.

◆ LaplaceDistribution() [2/2]

mlpack::distribution::LaplaceDistribution::LaplaceDistribution ( const arma::vec &  mean,
const double  scale 
)
inline

Construct the Laplace distribution with the given mean and scale parameter.

Parameters
meanMean of distribution.
scaleScale of distribution.

Member Function Documentation

◆ Estimate() [1/2]

void LaplaceDistribution::Estimate ( const arma::mat &  observations)

Estimate the Laplace distribution directly from the given observations.

Parameters
observationsList of observations.

◆ Estimate() [2/2]

void LaplaceDistribution::Estimate ( const arma::mat &  observations,
const arma::vec &  probabilities 
)

Estimate the Laplace distribution from the given observations, taking into account the probability of each observation actually being from this distribution.

Estimate the Laplace distribution directly from the given observations, taking into account the probability of each observation actually being from this distribution.

◆ LogProbability() [1/2]

double LaplaceDistribution::LogProbability ( const arma::vec &  observation) const

Return the log probability of the given observation.

Parameters
observationPoint to evaluate logarithm of probability.

◆ LogProbability() [2/2]

void mlpack::distribution::LaplaceDistribution::LogProbability ( const arma::mat &  x,
arma::vec &  logProbabilities 
) const
inline

Evaluate log probability density function of given observation.

Parameters
xList of observations.
logProbabilitiesOutput probabilities for each input observation.

◆ Probability() [1/2]

double mlpack::distribution::LaplaceDistribution::Probability ( const arma::vec &  observation) const
inline

Return the probability of the given observation.

Parameters
observationPoint to evaluate probability at.

◆ Probability() [2/2]

void LaplaceDistribution::Probability ( const arma::mat &  x,
arma::vec &  probabilities 
) const

Evaluate probability density function of given observation.

Parameters
xList of observations.
probabilitiesOutput probabilities for each input observation.

◆ Random()

arma::vec mlpack::distribution::LaplaceDistribution::Random ( ) const
inline

Return a randomly generated observation according to the probability distribution defined by this object.

This is inlined for speed.

Returns
Random observation from this Laplace distribution.

The documentation for this class was generated from the following files: