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"
33template <
typename DataType = arma::mat>
64 const bool applyLogistic =
true,
65 const double eps = 1e-10);
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"
Multiple independent Bernoulli distributions.
double LogProbability(const DataType &observation) const
Return the log probabilities of the given matrix of observations.
DataType Sample() const
Return a matrix of randomly generated samples according to the probability distributions defined by t...
double Probability(const DataType &observation) const
Return the probabilities of the given matrix of observations.
void LogProbBackward(const DataType &observation, DataType &output) const
Stores the gradient of the log probabilities of the observations in the output matrix.
DataType & Probability()
Return a modifiable copy of the probability matrix.
BernoulliDistribution(const DataType ¶m, const bool applyLogistic=true, const double eps=1e-10)
Create multiple independent Bernoulli distributions whose p values are given by the param parameter.
BernoulliDistribution()
Default constructor, which creates a Bernoulli distribution with zero dimension.
DataType & Logits()
Return a modifiable copy of the pre probability matrix.
const DataType & Probability() const
Return the probability matrix.
void serialize(Archive &ar, const unsigned int)
Serialize the distribution.
const DataType & Logits() const
Return the logits matrix.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.