NormalDistribution< DataType > Class Template Reference

Implementation of the Normal Distribution function. More...

Public Member Functions

 NormalDistribution ()
 Default constructor, which creates a Normal distribution with zero dimension. More...

 
 NormalDistribution (const DataType &mean, const DataType &sigma)
 Create a Normal distribution with the given mean and sigma. More...

 
size_t Dimensionality () const
 Return the dimensionality of this distribution. More...

 
DataType LogProbability (const DataType &observation) const
 Return the log probabilities of the given matrix of observations. More...

 
void LogProbability (const DataType &x, DataType &probabilities) const
 Calculates the log of normal probability density function for each data point (column) in the given matrix. More...

 
const DataType & Mean () const
 Get the mean. More...

 
DataType & Mean ()
 Modify the mean. More...

 
DataType Probability (const DataType &observation) const
 Return the probabilities of the given matrix of observations. More...

 
void Probability (const DataType &x, DataType &probabilities) const
 Calculates the normal probability density function for each data point (column) in the given matrix. More...

 
void ProbBackward (const DataType &observation, DataType &dmu, DataType &dsigma) const
 Stores the gradient of the probabilities of the observations with respect to mean and standard deviation. More...

 
DataType Sample () 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...

 
const DataType & StandardDeviation () const
 Get the standard deviation. More...

 
DataType & StandardDeviation ()
 Modify the standard deviation. More...

 

Detailed Description


template
<
typename
DataType
=
arma::mat
>

class mlpack::ann::NormalDistribution< DataType >

Implementation of the Normal Distribution function.

Normal distribution is a function which accepts a mean and a standard deviation term and creates a probability distribution out of it.

Template Parameters
DataTypeType of the input data. (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Definition at line 32 of file normal_distribution.hpp.

Constructor & Destructor Documentation

◆ NormalDistribution() [1/2]

Default constructor, which creates a Normal distribution with zero dimension.

◆ NormalDistribution() [2/2]

NormalDistribution ( const DataType &  mean,
const DataType &  sigma 
)

Create a Normal distribution with the given mean and sigma.

Parameters
meanThe mean of the normal distribution.
sigmaThe standard deviation of the normal distribution.

Member Function Documentation

◆ Dimensionality()

size_t Dimensionality ( ) const
inline

Return the dimensionality of this distribution.

Definition at line 123 of file normal_distribution.hpp.

References NormalDistribution< DataType >::serialize().

◆ LogProbability() [1/2]

DataType LogProbability ( const DataType &  observation) const

Return the log probabilities of the given matrix of observations.

Parameters
observationThe observation matrix.

Referenced by NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::Probability().

◆ LogProbability() [2/2]

void LogProbability ( const DataType &  x,
DataType &  probabilities 
) const
inline

Calculates the log of normal probability density function for each data point (column) in the given matrix.

Parameters
xThe observation matrix.
probabilitiesOutput log probabilities for each input observation.

Definition at line 97 of file normal_distribution.hpp.

References NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::Sample().

◆ Mean() [1/2]

const DataType& Mean ( ) const
inline

Get the mean.

Definition at line 111 of file normal_distribution.hpp.

◆ Mean() [2/2]

DataType& Mean ( )
inline

Modify the mean.

Definition at line 114 of file normal_distribution.hpp.

◆ Probability() [1/2]

DataType Probability ( const DataType &  observation) const
inline

Return the probabilities of the given matrix of observations.

Parameters
observationThe observation matrix.

Definition at line 54 of file normal_distribution.hpp.

References NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::ProbBackward().

Referenced by NormalDistribution< DataType >::Probability().

◆ Probability() [2/2]

void Probability ( const DataType &  x,
DataType &  probabilities 
) const
inline

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

Parameters
xThe observation matrix.
probabilitiesOutput probabilities for each input observation.

Definition at line 85 of file normal_distribution.hpp.

References NormalDistribution< DataType >::Probability().

◆ ProbBackward()

void ProbBackward ( const DataType &  observation,
DataType &  dmu,
DataType &  dsigma 
) const

Stores the gradient of the probabilities of the observations with respect to mean and standard deviation.

Parameters
observationThe observation matrix.
dmuThe gradient with respect to mean.
dsigmaThe gradient with respect to the standard deviation.

Referenced by NormalDistribution< DataType >::Probability().

◆ Sample()

DataType Sample ( ) const

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

Returns
Random observation from this Normal distribution.

Referenced by NormalDistribution< DataType >::LogProbability().

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the distribution.

Referenced by NormalDistribution< DataType >::Dimensionality().

◆ StandardDeviation() [1/2]

const DataType& StandardDeviation ( ) const
inline

Get the standard deviation.

Definition at line 117 of file normal_distribution.hpp.

◆ StandardDeviation() [2/2]

DataType& StandardDeviation ( )
inline

Modify the standard deviation.

Definition at line 120 of file normal_distribution.hpp.


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