mlpack
Public Member Functions | List of all members
mlpack::ann::NormalDistribution< DataType > Class Template Reference

Implementation of the Normal Distribution function. More...

#include <normal_distribution.hpp>

Public Member Functions

 NormalDistribution ()
 Default constructor, which creates a Normal distribution with zero dimension.
 
 NormalDistribution (const DataType &mean, const DataType &sigma)
 Create a Normal distribution with the given mean and sigma. More...
 
DataType Probability (const DataType &observation) const
 Return the probabilities of the given matrix of observations. More...
 
DataType LogProbability (const DataType &observation) const
 Return the log probabilities of the given matrix of observations. 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...
 
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 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...
 
DataType Sample () const
 Return a randomly generated observation according to the probability distribution defined by this object. More...
 
const DataType & Mean () const
 Get the mean.
 
DataType & Mean ()
 Modify the mean.
 
const DataType & StandardDeviation () const
 Get the standard deviation.
 
DataType & StandardDeviation ()
 Modify the standard deviation.
 
size_t Dimensionality () const
 Return the dimensionality of this distribution.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the distribution.
 

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

Constructor & Destructor Documentation

◆ NormalDistribution()

template<typename DataType >
mlpack::ann::NormalDistribution< DataType >::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

◆ LogProbability() [1/2]

template<typename DataType >
DataType mlpack::ann::NormalDistribution< DataType >::LogProbability ( const DataType &  observation) const

Return the log probabilities of the given matrix of observations.

Parameters
observationThe observation matrix.

◆ LogProbability() [2/2]

template<typename DataType = arma::mat>
void mlpack::ann::NormalDistribution< DataType >::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.

◆ Probability() [1/2]

template<typename DataType = arma::mat>
DataType mlpack::ann::NormalDistribution< DataType >::Probability ( const DataType &  observation) const
inline

Return the probabilities of the given matrix of observations.

Parameters
observationThe observation matrix.

◆ Probability() [2/2]

template<typename DataType = arma::mat>
void mlpack::ann::NormalDistribution< DataType >::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.

◆ ProbBackward()

template<typename DataType >
void mlpack::ann::NormalDistribution< DataType >::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.

◆ Sample()

template<typename DataType >
DataType mlpack::ann::NormalDistribution< DataType >::Sample ( ) const

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

Returns
Random observation from this Normal distribution.

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