mlpack 3.4.2
Public Member Functions | List of all members
DiagonalGaussianDistribution Class Reference

A single multivariate Gaussian distribution with diagonal covariance. More...

#include <diagonal_gaussian_distribution.hpp>

Public Member Functions

 DiagonalGaussianDistribution ()
 Default constructor, which creates a Gaussian with zero dimension. More...
 
 DiagonalGaussianDistribution (const arma::vec &mean, const arma::vec &covariance)
 Create a Gaussian distribution with the given mean and diagonal covariance. More...
 
 DiagonalGaussianDistribution (const size_t dimension)
 Create a Gaussian Distribution with zero mean and diagonal covariance with the given dimensionality. More...
 
const arma::vec & Covariance () const
 Return the covariance matrix. More...
 
void Covariance (arma::vec &&covariance)
 Set the covariance matrix using move assignment. More...
 
void Covariance (const arma::vec &covariance)
 Set the covariance matrix. More...
 
size_t Dimensionality () const
 Return the dimensionality of this distribution. More...
 
void LogProbability (const arma::mat &observations, arma::vec &logProbabilities) const
 Calculate the multivariate Gaussian log probability density function for each data point (column) in the given matrix. More...
 
double LogProbability (const arma::vec &observation) const
 Return the log probability of the given observation. More...
 
arma::vec & Mean ()
 Return a modifiable copy of the mean. More...
 
const arma::vec & Mean () const
 Return the mean. More...
 
void Probability (const arma::mat &x, arma::vec &probabilities) const
 Calculate the multivariate Gaussian probability density function for each data point (column) in the given matrix. More...
 
double Probability (const arma::vec &observation) const
 Return the probability of the given observation. More...
 
arma::vec Random () const
 Return a randomly generated observation according to the probability distribution defined by this object. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 Serialize the distribution. More...
 
void Train (const arma::mat &observations)
 Estimate the Gaussian distribution directly from the given observations. More...
 
void Train (const arma::mat &observations, const arma::vec &probabilities)
 Estimate the Gaussian distribution from the given observations, taking into account the probability of each observation actually being from this distribution. More...
 

Detailed Description

A single multivariate Gaussian distribution with diagonal covariance.

Definition at line 21 of file diagonal_gaussian_distribution.hpp.

Constructor & Destructor Documentation

◆ DiagonalGaussianDistribution() [1/3]

Default constructor, which creates a Gaussian with zero dimension.

Definition at line 38 of file diagonal_gaussian_distribution.hpp.

◆ DiagonalGaussianDistribution() [2/3]

DiagonalGaussianDistribution ( const size_t  dimension)
inline

Create a Gaussian Distribution with zero mean and diagonal covariance with the given dimensionality.

Parameters
dimensionNumber of dimensions.

Definition at line 46 of file diagonal_gaussian_distribution.hpp.

◆ DiagonalGaussianDistribution() [3/3]

DiagonalGaussianDistribution ( const arma::vec &  mean,
const arma::vec &  covariance 
)

Create a Gaussian distribution with the given mean and diagonal covariance.

Parameters
meanMean of distribution.
covarianceCovariance of distribution.

Member Function Documentation

◆ Covariance() [1/3]

const arma::vec & Covariance ( ) const
inline

Return the covariance matrix.

Definition at line 133 of file diagonal_gaussian_distribution.hpp.

◆ Covariance() [2/3]

void Covariance ( arma::vec &&  covariance)

Set the covariance matrix using move assignment.

◆ Covariance() [3/3]

void Covariance ( const arma::vec &  covariance)

Set the covariance matrix.

◆ Dimensionality()

size_t Dimensionality ( ) const
inline

Return the dimensionality of this distribution.

Definition at line 64 of file diagonal_gaussian_distribution.hpp.

◆ LogProbability() [1/2]

void LogProbability ( const arma::mat &  observations,
arma::vec &  logProbabilities 
) const

Calculate the multivariate Gaussian log probability density function for each data point (column) in the given matrix.

Parameters
observationsMatrix of observations.
logProbabilitiesOutput log probabilities for each observation.

◆ LogProbability() [2/2]

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

Return the log probability of the given observation.

Referenced by DiagonalGaussianDistribution::Probability().

◆ Mean() [1/2]

arma::vec & Mean ( )
inline

Return a modifiable copy of the mean.

Definition at line 130 of file diagonal_gaussian_distribution.hpp.

◆ Mean() [2/2]

const arma::vec & Mean ( ) const
inline

Return the mean.

Definition at line 127 of file diagonal_gaussian_distribution.hpp.

◆ Probability() [1/2]

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

Calculate the multivariate Gaussian probability density function for each data point (column) in the given matrix.

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

Definition at line 82 of file diagonal_gaussian_distribution.hpp.

References DiagonalGaussianDistribution::LogProbability().

◆ Probability() [2/2]

double Probability ( const arma::vec &  observation) const
inline

Return the probability of the given observation.

Definition at line 67 of file diagonal_gaussian_distribution.hpp.

References DiagonalGaussianDistribution::LogProbability().

◆ Random()

arma::vec Random ( ) const

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

Returns
Random observation from this Diagonal Gaussian distribution.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int   
)
inline

Serialize the distribution.

Definition at line 143 of file diagonal_gaussian_distribution.hpp.

◆ Train() [1/2]

void Train ( const arma::mat &  observations)

Estimate the Gaussian distribution directly from the given observations.

Parameters
observationsMatrix of observations.

◆ Train() [2/2]

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

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

Parameters
observationsMatrix of observations.
probabilitiesList of probability of the each observation being from this distribution.

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