This class represents the weighted sum of a finite set of probability density functions. More...
#include <Mixture.h>
Classes | |
struct | MixtureStruct |
Public Member Functions | |
void | addComponent (const PDF &pdf, double w) |
Adds a component pdf with given weight. More... | |
void | clear () |
Removes all components. More... | |
Mixture * | 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. More... | |
int | components () const |
Returns the number of components. More... | |
const PDF & | getComponent (int i) const |
Returns a reference to the i'th component. More... | |
double | getLikelihood (const PDF &pdf) const |
double | getMaxDensity () const |
NOT IMPLEMENTED FOR MIXTURE. More... | |
double | getWeight (int i) const |
Returns the weight of the i'th component. More... | |
Mixture () | |
Constructs a mixture pdf with no initial components. More... | |
Mixture (const Mixture &orig) | |
Copy constructor. More... | |
void | normalizeWeights () |
Normalizes the weights of all components. More... | |
Mixture & | operator= (const Mixture &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. More... | |
std::string | toString (const std::string &indent="") const |
Represents the Mixture as a string for easier console output. More... | |
virtual | ~Mixture () |
Destructor. More... | |
Public Member Functions inherited from pbl::PDF | |
int | dimensions () const |
virtual bool | getExpectedValue (std::string &v) const |
virtual bool | getExpectedValue (arma::vec &v) const |
PDF (int dimensions, PDFType type) | |
PDF (const PDF &orig) | |
PDFType | type () const |
virtual | ~PDF () |
Protected Member Functions | |
void | cloneStruct () |
Protected Attributes | |
MixtureStruct * | ptr_ |
Protected Attributes inherited from pbl::PDF | |
int | dimensions_ |
PDFType | type_ |
Additional Inherited Members | |
Public Types inherited from pbl::PDF | |
enum | PDFType { GAUSSIAN, MIXTURE, UNIFORM, DISCRETE, EXACT, HYBRID, UNKNOWN } |
This class represents the weighted sum of a finite set of probability density functions.
Mixture::Mixture | ( | ) |
Constructs a mixture pdf with no initial components.
Definition at line 41 of file Mixture.cpp.
Mixture::Mixture | ( | const Mixture & | orig | ) |
Copy constructor.
Definition at line 44 of file Mixture.cpp.
|
virtual |
Destructor.
Definition at line 50 of file Mixture.cpp.
void Mixture::addComponent | ( | const PDF & | pdf, |
double | w | ||
) |
Adds a component pdf with given weight.
The component pdf | |
w | Weight of the component |
Definition at line 120 of file Mixture.cpp.
void Mixture::clear | ( | ) |
Removes all components.
Definition at line 101 of file Mixture.cpp.
|
virtual |
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.
Implements pbl::PDF.
Definition at line 76 of file Mixture.cpp.
|
protected |
Definition at line 80 of file Mixture.cpp.
int Mixture::components | ( | ) | const |
Returns the number of components.
Definition at line 116 of file Mixture.cpp.
const PDF & Mixture::getComponent | ( | int | i | ) | const |
Returns a reference to the i'th component.
i | Index of the component |
Definition at line 139 of file Mixture.cpp.
|
virtual |
Implements pbl::PDF.
Definition at line 87 of file Mixture.cpp.
|
virtual |
double Mixture::getWeight | ( | int | i | ) | const |
Returns the weight of the i'th component.
i | Index of the component |
Definition at line 144 of file Mixture.cpp.
void Mixture::normalizeWeights | ( | ) |
Normalizes the weights of all components.
Definition at line 149 of file Mixture.cpp.
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.
Definition at line 60 of file Mixture.cpp.
|
virtual |
Represents the Mixture as a string for easier console output.
Implements pbl::PDF.
Definition at line 162 of file Mixture.cpp.
|
protected |