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... | |
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.
DataType | Type of the input data. (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 32 of file normal_distribution.hpp.
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.
mean | The mean of the normal distribution. |
sigma | The standard deviation of the normal distribution. |
|
inline |
Return the dimensionality of this distribution.
Definition at line 123 of file normal_distribution.hpp.
References NormalDistribution< DataType >::serialize().
DataType LogProbability | ( | const DataType & | observation | ) | const |
Return the log probabilities of the given matrix of observations.
observation | The observation matrix. |
Referenced by NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::Probability().
|
inline |
Calculates the log of normal probability density function for each data point (column) in the given matrix.
x | The observation matrix. |
probabilities | Output log probabilities for each input observation. |
Definition at line 97 of file normal_distribution.hpp.
References NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::Sample().
|
inline |
Get the mean.
Definition at line 111 of file normal_distribution.hpp.
|
inline |
Modify the mean.
Definition at line 114 of file normal_distribution.hpp.
|
inline |
Return the probabilities of the given matrix of observations.
observation | The observation matrix. |
Definition at line 54 of file normal_distribution.hpp.
References NormalDistribution< DataType >::LogProbability(), and NormalDistribution< DataType >::ProbBackward().
Referenced by NormalDistribution< DataType >::Probability().
|
inline |
Calculates the normal probability density function for each data point (column) in the given matrix.
x | The observation matrix. |
probabilities | Output probabilities for each input observation. |
Definition at line 85 of file normal_distribution.hpp.
References NormalDistribution< DataType >::Probability().
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.
observation | The observation matrix. |
dmu | The gradient with respect to mean. |
dsigma | The gradient with respect to the standard deviation. |
Referenced by NormalDistribution< DataType >::Probability().
DataType Sample | ( | ) | const |
Return a randomly generated observation according to the probability distribution defined by this object.
Referenced by NormalDistribution< DataType >::LogProbability().
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the distribution.
Referenced by NormalDistribution< DataType >::Dimensionality().
|
inline |
Get the standard deviation.
Definition at line 117 of file normal_distribution.hpp.
|
inline |
Modify the standard deviation.
Definition at line 120 of file normal_distribution.hpp.