37 #ifndef PROBLIB_PMF_H_ 38 #define PROBLIB_PMF_H_ 63 PMF(
int domain_size = -1);
101 double getProbability(
const std::string& value,
int domain_size)
const;
112 void setExact(
const std::string& value);
117 void getValues(std::vector<std::string>& values)
const;
154 std::string
toString(
const std::string& indent =
"")
const;
177 std::map<std::string, double>
pmf_;
181 PMFStruct(
int domain_size) : domain_size_(domain_size), total_prob_(0), n_ptrs_(1) { }
183 PMFStruct(
const PMFStruct& orig) : domain_size_(orig.domain_size_), total_prob_(orig.total_prob_), pmf_(orig.pmf_), n_ptrs_(1) { }
double getProbability(const std::string &value) const
Returns the probability of the given value.
std::string getMostProbableValue() const
PMF(int domain_size=-1)
Constructs a discrete probability distribution. The optional parameter domain size states the number ...
double getLikelihood(const PDF &pdf) const
PMFStruct(int domain_size)
double getMaxDensity() const
void setExact(const std::string &value)
Set the probability of the given value to 1. All other values are given a probability of 0...
PMF & operator=(const PMF &other)
Assignment operator. The operation is cheap since it only copies a pointer. A deep clone will only be...
void setDomainSize(int domain_size)
Sets the domain size of this discrete distribution.
PMFStruct(const PMFStruct &orig)
void getValues(std::vector< std::string > &values) const
Returns a vector of values for which a probability is specified.
std::string toString(const std::string &indent="") const
Represents the PMF as a string for easier console output.
bool getExpectedValue(std::string &v) const
Returns in parameter v the expected value for this distribution, i.e., the value with the highest pro...
void update(const pbl::PMF &pmf)
std::map< std::string, double > pmf_
int getDomainSize() const
Returns the domain size of this distribution.
void getProbabilities(std::vector< double > &probabilities) const
Returns all probabilities of the known values.
double getProbabilityUnknown() const
void setProbability(const std::string &value, double p)
Set the probability of a given value.
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.
virtual ~PMF()
Destructor.
This class represents a discrete probability distribution (or probability mass function). Currently, this PMF can only take strings as values.
double getDensity(const arma::vec &v) const