A discrete distribution where the only observations are discrete observations.
DiscreteDistribution ()
Default constructor, which creates a distribution that has no observations. DiscreteDistribution (const size_t numObservations)
Define the discrete distribution as having numObservations possible observations. DiscreteDistribution (const arma::vec &probabilities)
Define the discrete distribution as having the given probabilities for each observation. size_t Dimensionality () const
Get the dimensionality of the distribution. void Estimate (const arma::mat &observations)
Estimate the probability distribution directly from the given observations. void Estimate (const arma::mat &observations, const arma::vec &probabilities)
Estimate the probability distribution from the given observations, taking into account the probability of each observation actually being from this distribution. const arma::vec & Probabilities () const
Return the vector of probabilities. arma::vec & Probabilities ()
Modify the vector of probabilities. double Probability (const arma::vec &observation) const
Return the probability of the given observation. arma::vec Random () const
Return a randomly generated observation (one-dimensional vector; one observation) according to the probability distribution defined by this object. std::string ToString () const
arma::vec probabilities
A discrete distribution where the only observations are discrete observations.
This is useful (for example) with discrete Hidden Markov Models, where observations are non-negative integers representing specific emissions.
No bounds checking is performed for observations, so if an invalid observation is passed (i.e. observation > numObservations), a crash will probably occur.
This distribution only supports one-dimensional observations, so when passing an arma::vec as an observation, it should only have one dimension (vec.n_rows == 1). Any additional dimensions will simply be ignored.
Note:
This class, like every other class in MLPACK, uses arma::vec to represent observations. While a discrete distribution only has positive integers (size_t) as observations, these can be converted to doubles (which is what arma::vec holds). This distribution internally converts those doubles back into size_t before comparisons.
Definition at line 53 of file discrete_distribution.hpp.
Default constructor, which creates a distribution that has no observations.
Definition at line 59 of file discrete_distribution.hpp.
Define the discrete distribution as having numObservations possible observations. The probability in each state will be set to (1 / numObservations).
Parameters:
numObservations Number of possible observations this distribution can have.
Definition at line 69 of file discrete_distribution.hpp.
Define the discrete distribution as having the given probabilities for each observation.
Parameters:
probabilities Probabilities of each possible observation.
Definition at line 79 of file discrete_distribution.hpp.
Get the dimensionality of the distribution.
Definition at line 95 of file discrete_distribution.hpp.
Estimate the probability distribution directly from the given observations. If any of the observations is greater than numObservations, a crash is likely to occur.
Parameters:
observations List of observations.
Estimate the probability distribution from the given observations, taking into account the probability of each observation actually being from this distribution.
Parameters:
observations List of observations.
probabilities List of probabilities that each observation is actually from this distribution.
Return the vector of probabilities.
Definition at line 153 of file discrete_distribution.hpp.
References probabilities.
Modify the vector of probabilities.
Definition at line 155 of file discrete_distribution.hpp.
References probabilities.
Return the probability of the given observation. If the observation is greater than the number of possible observations, then a crash will probably occur -- bounds checking is not performed.
Parameters:
observation Observation to return the probability of.
Returns:
Probability of the given observation.
Definition at line 105 of file discrete_distribution.hpp.
References mlpack::Log::Debug, and probabilities.
Return a randomly generated observation (one-dimensional vector; one observation) according to the probability distribution defined by this object.
Returns:
Random observation.
Definition at line 163 of file discrete_distribution.hpp.
Referenced by Probabilities(), and Probability().
Generated automatically by Doxygen for MLPACK from the source code.