18 #ifndef _MLPACK_CORE_DISTRIBUTIONS_GAMMA_DISTRIBUTION_HPP 19 #define _MLPACK_CORE_DISTRIBUTIONS_GAMMA_DISTRIBUTION_HPP 23 #include <boost/program_options.hpp> 26 namespace distribution {
94 void Train(
const arma::mat& rdata,
const double tol = 1e-8);
107 void Train(
const arma::mat& observations,
108 const arma::vec& probabilities,
109 const double tol = 1e-8);
123 void Train(
const arma::vec& logMeanxVec,
124 const arma::vec& meanLogxVec,
125 const arma::vec& meanxVec,
126 const double tol = 1e-8);
144 arma::vec& Probabilities)
const;
173 arma::vec& LogProbabilities)
const;
183 double Alpha(
const size_t dim)
const {
return alpha[dim]; }
185 double&
Alpha(
const size_t dim) {
return alpha[dim]; }
188 double Beta(
const size_t dim)
const {
return beta[dim]; }
190 double&
Beta(
const size_t dim) {
return beta[dim]; }
size_t Dimensionality() const
Get the dimensionality of the distribution.
bool Converged(const double aOld, const double aNew, const double tol)
This is a small function that returns true if the update of alpha is smaller than the tolerance ratio...
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
arma::vec alpha
Array of fitted alphas.
arma::vec beta
Array of fitted betas.
double Alpha(const size_t dim) const
Get the alpha parameter of the given dimension.
void Train(const arma::mat &rdata, const double tol=1e-8)
This function trains (fits distribution parameters) to new data or the dataset the object owns...
double Beta(const size_t dim) const
Get the beta parameter of the given dimension.
~GammaDistribution()
Destructor.
void LogProbability(const arma::mat &observations, arma::vec &LogProbabilities) const
This function returns the logarithm of the probability of a group of observations.
double & Alpha(const size_t dim)
Modify the alpha parameter of the given dimension.
GammaDistribution(const size_t dimensionality=0)
Construct the Gamma distribution with the given number of dimensions (default 0); each parameter will...
void Probability(const arma::mat &observations, arma::vec &Probabilities) const
This function returns the probability of a group of observations.
Miscellaneous math random-related routines.
This class represents the Gamma distribution.
arma::vec Random() const
This function returns an observation of this distribution.
double & Beta(const size_t dim)
Modify the beta parameter of the given dimension.