GaussianDistribution Class Reference

A single multivariate Gaussian distribution. More...

Public Member Functions

 GaussianDistribution ()
 Default constructor, which creates a Gaussian with zero dimension. More...

 
 GaussianDistribution (const size_t dimension)
 Create a Gaussian distribution with zero mean and identity covariance with the given dimensionality. More...

 
 GaussianDistribution (const arma::vec &mean, const arma::mat &covariance)
 Create a Gaussian distribution with the given mean and covariance. More...

 
const arma::mat & Covariance () const
 Return the covariance matrix. More...

 
void Covariance (const arma::mat &covariance)
 Set the covariance. More...

 
void Covariance (arma::mat &&covariance)
 
size_t Dimensionality () const
 Return the dimensionality of this distribution. More...

 
const arma::mat & InvCov () const
 Return the invCov. More...

 
double LogDetCov () const
 Return the logDetCov. 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
 Returns the Log probability of the given matrix. More...

 
const arma::vec & Mean () const
 Return the mean. More...

 
arma::vec & Mean ()
 Return a modifiable copy of the mean. More...

 
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
 Calculates the multivariate Gaussian probability density function for each data point (column) in the given matrix. 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 uint32_t)
 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.

Definition at line 24 of file gaussian_distribution.hpp.

Constructor & Destructor Documentation

◆ GaussianDistribution() [1/3]

Default constructor, which creates a Gaussian with zero dimension.

Definition at line 45 of file gaussian_distribution.hpp.

Referenced by GaussianDistribution::GaussianDistribution().

◆ GaussianDistribution() [2/3]

GaussianDistribution ( const size_t  dimension)
inline

Create a Gaussian distribution with zero mean and identity covariance with the given dimensionality.

Definition at line 51 of file gaussian_distribution.hpp.

References GaussianDistribution::GaussianDistribution().

◆ GaussianDistribution() [3/3]

GaussianDistribution ( const arma::vec &  mean,
const arma::mat &  covariance 
)

Create a Gaussian distribution with the given mean and covariance.

covariance is expected to be positive definite.

Member Function Documentation

◆ Covariance() [1/3]

const arma::mat& Covariance ( ) const
inline

Return the covariance matrix.

Definition at line 156 of file gaussian_distribution.hpp.

Referenced by RegressionDistribution::RegressionDistribution().

◆ Covariance() [2/3]

void Covariance ( const arma::mat &  covariance)

Set the covariance.

◆ Covariance() [3/3]

void Covariance ( arma::mat &&  covariance)

◆ Dimensionality()

size_t Dimensionality ( ) const
inline

Return the dimensionality of this distribution.

Definition at line 69 of file gaussian_distribution.hpp.

◆ InvCov()

const arma::mat& InvCov ( ) const
inline

Return the invCov.

Definition at line 166 of file gaussian_distribution.hpp.

◆ LogDetCov()

double LogDetCov ( ) const
inline

Return the logDetCov.

Definition at line 169 of file gaussian_distribution.hpp.

◆ LogProbability() [1/2]

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

Return the log probability of the given observation.

Referenced by GaussianDistribution::Probability().

◆ LogProbability() [2/2]

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

Returns the Log probability of the given matrix.

These values are stored in logProbabilities.

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

Definition at line 108 of file gaussian_distribution.hpp.

References GaussianDistribution::Random(), and GaussianDistribution::Train().

◆ Mean() [1/2]

const arma::vec& Mean ( ) const
inline

Return the mean.

Definition at line 146 of file gaussian_distribution.hpp.

◆ Mean() [2/2]

arma::vec& Mean ( )
inline

Return a modifiable copy of the mean.

Definition at line 151 of file gaussian_distribution.hpp.

◆ Probability() [1/2]

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

Return the probability of the given observation.

Definition at line 74 of file gaussian_distribution.hpp.

References GaussianDistribution::LogProbability().

◆ Probability() [2/2]

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

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

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

Definition at line 91 of file gaussian_distribution.hpp.

References GaussianDistribution::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 Gaussian distribution.

Referenced by LogisticRegressionTestData(), and GaussianDistribution::LogProbability().

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)
inline

Serialize the distribution.

Definition at line 175 of file gaussian_distribution.hpp.

◆ Train() [1/2]

void Train ( const arma::mat &  observations)

Estimate the Gaussian distribution directly from the given observations.

Parameters
observationsList of observations.

Referenced by GaussianDistribution::LogProbability().

◆ 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.


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