This class represents a discrete probability distribution (or probability mass function). Currently, this PMF can only take strings as values.
More...
Classes |
struct | PMFStruct |
Public Member Functions |
PMF * | clone () const |
| Creates a clone of the object. The clone method is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified.
|
double | getDensity (const arma::vec &v) const |
int | getDomainSize () const |
| Returns the domain size of this distribution.
|
bool | getExpectedValue (std::string &v) const |
| Returns in parameter v the expected value for this distribution, i.e., the value with the highest probability.
|
double | getLikelihood (const PDF &pdf) const |
double | getLikelihood (const PMF &pmf) const |
double | getMaxDensity () const |
std::string | getMostProbableValue () const |
void | getProbabilities (std::vector< double > &probabilities) const |
| Returns all probabilities of the known values.
|
double | getProbability (const std::string &value) const |
| Returns the probability of the given value.
|
double | getProbability (const std::string &value, int domain_size) const |
| Returns the probability of the given value, for a given domain_size. The domain size determines the probability if the value is unknown, in which case a uniform distribution over all unknown values is assumed.
|
double | getProbabilityUnknown () const |
double | getProbabilityUnknown (int domain_size) const |
void | getValues (std::vector< std::string > &values) const |
| Returns a vector of values for which a probability is specified.
|
void | normalize () |
PMF & | operator= (const PMF &other) |
| Assignment operator. The operation is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified.
|
| PMF (int domain_size=-1) |
| Constructs a discrete probability distribution. The optional parameter domain size states the number of possible values of the random variable underlying this distribution, and determines the probability of unknown values if the probabilities of all unknown values do not sum up to one.
|
| PMF (const PMF &pmf) |
| Copy constructor.
|
void | setDomainSize (int domain_size) |
| Sets the domain size of this discrete distribution.
|
void | setExact (const std::string &value) |
| Set the probability of the given value to 1. All other values are given a probability of 0.
|
void | setProbability (const std::string &value, double p) |
| Set the probability of a given value.
|
std::string | toString (const std::string &indent="") const |
| Represents the PMF as a string for easier console output.
|
void | update (const pbl::PMF &pmf) |
virtual | ~PMF () |
| Destructor.
|
Protected Member Functions |
void | cloneStruct () |
Protected Attributes |
PMFStruct * | ptr_ |
This class represents a discrete probability distribution (or probability mass function). Currently, this PMF can only take strings as values.
- Author:
- Sjoerd van den Dries
- Date:
- December, 2012
- Version:
- 1.0
Definition at line 52 of file PMF.h.