12 #ifndef MLPACK_METHODS_ANN_DISTRIBUTIONS_BERNOULLI_DISTRIBUTION_HPP 13 #define MLPACK_METHODS_ANN_DISTRIBUTIONS_BERNOULLI_DISTRIBUTION_HPP 16 #include "../activation_functions/logistic_function.hpp" 33 template <
typename DataType = arma::mat>
64 const bool applyLogistic =
true,
65 const double eps = 1e-10);
91 void LogProbBackward(
const DataType&& observation, DataType&& output)
const;
108 const DataType&
Logits()
const {
return logits; }
116 template<
typename Archive>
120 ar & BOOST_SERIALIZATION_NVP(probability);
121 ar & BOOST_SERIALIZATION_NVP(logits);
122 ar & BOOST_SERIALIZATION_NVP(applyLogistic);
123 ar & BOOST_SERIALIZATION_NVP(eps);
128 DataType probability;
145 #include "bernoulli_distribution_impl.hpp" const DataType & Probability() const
Return the probability matrix.
The core includes that mlpack expects; standard C++ includes and Armadillo.
const DataType & Logits() const
Return the logits matrix.
double Probability(const DataType &&observation) const
Return the probabilities of the given matrix of observations.
Multiple independent Bernoulli distributions.
void LogProbBackward(const DataType &&observation, DataType &&output) const
Stores the gradient of the log probabilities of the observations in the output matrix.
void serialize(Archive &ar, const unsigned int)
Serialize the distribution.
DataType & Logits()
Return a modifiable copy of the pre probability matrix.
DataType & Probability()
Return a modifiable copy of the probability matrix.
BernoulliDistribution()
Default constructor, which creates a Bernoulli distribution with zero dimension.
DataType Sample() const
Return a matrix of randomly generated samples according to the probability distributions defined by t...
double LogProbability(const DataType &&observation) const
Return the log probabilities of the given matrix of observations.