|
| 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. More...
|
|
| DiscreteDistribution (const arma::Col< size_t > &numObservations) |
| Define the multidimensional discrete distribution as having numObservations possible observations. More...
|
|
| DiscreteDistribution (const std::vector< arma::vec > &probabilities) |
| Define the multidimensional discrete distribution as having the given probabilities for each observation. More...
|
|
size_t | Dimensionality () const |
| Get the dimensionality of the distribution.
|
|
double | Probability (const arma::vec &observation) const |
| Return the probability of the given observation. More...
|
|
double | LogProbability (const arma::vec &observation) const |
| Return the log probability of the given observation. More...
|
|
void | Probability (const arma::mat &x, arma::vec &probabilities) const |
| Calculates the Discrete probability density function for each data point (column) in the given matrix. More...
|
|
void | LogProbability (const arma::mat &x, arma::vec &logProbabilities) const |
| Returns the Log probability of the given matrix. More...
|
|
arma::vec | Random () const |
| Return a randomly generated observation (one-dimensional vector; one observation) according to the probability distribution defined by this object. More...
|
|
void | Train (const arma::mat &observations) |
| Estimate the probability distribution directly from the given observations. More...
|
|
void | Train (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. More...
|
|
arma::vec & | Probabilities (const size_t dim=0) |
| Return the vector of probabilities for the given dimension.
|
|
const arma::vec & | Probabilities (const size_t dim=0) const |
| Modify the vector of probabilities for the given dimension.
|
|
template<typename Archive > |
void | serialize (Archive &ar, const uint32_t) |
| Serialize the distribution.
|
|
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.