Multiple independent Bernoulli distributions. More...
Public Member Functions  
BernoulliDistribution ()  
Default constructor, which creates a Bernoulli distribution with zero dimension. More...  
BernoulliDistribution (const DataType ¶m, const bool applyLogistic=true, const double eps=1e10)  
Create multiple independent Bernoulli distributions whose p values are given by the param parameter. More...  
const DataType &  Logits () const 
Return the logits matrix. More...  
DataType &  Logits () 
Return a modifiable copy of the pre probability matrix. More...  
double  LogProbability (const DataType &observation) const 
Return the log probabilities of the given matrix of observations. More...  
void  LogProbBackward (const DataType &observation, DataType &output) const 
Stores the gradient of the log probabilities of the observations in the output matrix. More...  
double  Probability (const DataType &observation) const 
Return the probabilities of the given matrix of observations. More...  
const DataType &  Probability () const 
Return the probability matrix. More...  
DataType &  Probability () 
Return a modifiable copy of the probability matrix. More...  
DataType  Sample () const 
Return a matrix of randomly generated samples according to the probability distributions defined by this object. More...  
template  
void  serialize (Archive &ar, const unsigned int) 
Serialize the distribution. More...  
Multiple independent Bernoulli distributions.
Bernoulli distribution is the discrete probability distribution of a random variable which takes the value 1 with probability p and the value 0 with probability q = 1  p. In this implementation, the p values of the distributions are given by the param matrix.
DataType  Type of the input data. (arma::colvec, arma::mat, arma::sp_mat or arma::cube). 
Definition at line 34 of file bernoulli_distribution.hpp.
Default constructor, which creates a Bernoulli distribution with zero dimension.
BernoulliDistribution  (  const DataType &  param, 
const bool  applyLogistic = true , 

const double  eps = 1e10 

) 
Create multiple independent Bernoulli distributions whose p values are given by the param parameter.
Thus, we create nofRows * nofColumns distributions. The shape of the matrix of distributions is the same as the shape of the param matrix as each element of the param matrix parameterizes one Bernoulli distribution. This is used in the ANN module to define distribution for each feature in each batch, where number of features becomes nofRows and batch size becomes nofColumns.
applyLogistic has to be true if all the elements of param matrix are not in the range [0, 1].
param  The matrix of probabilities or pre probabilities of the multiple distributions. 
applyLogistic  If true, we apply Logistic function to the param matrix (pre probability) to get probability. 
eps  The minimum value used for computing logarithms and denominators. 

inline 
Return the logits matrix.
Definition at line 108 of file bernoulli_distribution.hpp.

inline 
Return a modifiable copy of the pre probability matrix.
Definition at line 111 of file bernoulli_distribution.hpp.
double LogProbability  (  const DataType &  observation  )  const 
Return the log probabilities of the given matrix of observations.
observation  The observation matrix. 
Referenced by BernoulliDistribution< DataType >::Probability().
void LogProbBackward  (  const DataType &  observation, 
DataType &  output  
)  const 
Stores the gradient of the log probabilities of the observations in the output matrix.
observation  The observation matrix. 
output  The output matrix where the gradients are stored. 
Referenced by BernoulliDistribution< DataType >::Probability().

inline 
Return the probabilities of the given matrix of observations.
observation  The observation matrix. 
Definition at line 72 of file bernoulli_distribution.hpp.
References BernoulliDistribution< DataType >::LogProbability(), BernoulliDistribution< DataType >::LogProbBackward(), and BernoulliDistribution< DataType >::Sample().

inline 
Return the probability matrix.
Definition at line 102 of file bernoulli_distribution.hpp.

inline 
Return a modifiable copy of the probability matrix.
Definition at line 105 of file bernoulli_distribution.hpp.
DataType Sample  (  )  const 
Return a matrix of randomly generated samples according to the probability distributions defined by this object.
Referenced by BernoulliDistribution< DataType >::Probability().

inline 
Serialize the distribution.
Definition at line 117 of file bernoulli_distribution.hpp.