Class representing a mixture of PDFs, the mixture can contain different. More...
#include <mixture.h>
Public Member Functions | |
bool | AddComponent (Pdf< T > &pdf) |
Add a component pdf: THIS IS A NON-REALTIME OPERATION. | |
bool | AddComponent (Pdf< T > &pdf, Probability w) |
Add a component pdf with weight w: THIS IS A NON-REALTIME OPERATION. | |
virtual Mixture * | Clone () const |
Clone function. | |
Pdf< T > * | ComponentGet (unsigned int componentNumber) const |
Get the pointer to the component pdf of component "componentNumber". | |
vector< Pdf< T > * > | ComponentsGet () const |
Get the vector of pointers to the component pdfs. | |
MatrixWrapper::SymmetricMatrix | CovarianceGet () const |
Get the Covariance Matrix E[(x - E[x])^2] of the Analytic pdf. | |
bool | DeleteComponent (unsigned int componentNumber) |
Delete a component pdf: THIS IS A NON_REALTIME OPERATION. | |
template<> | |
ColumnVector | ExpectedValueGet () const |
Get the expected value E[x] of the pdf. | |
template<> | |
unsigned int | ExpectedValueGet () const |
Get the expected value E[x] of the pdf. | |
template<> | |
int | ExpectedValueGet () const |
Get the expected value E[x] of the pdf. | |
T | ExpectedValueGet () const |
Get the expected value E[x] of the pdf. | |
template<> | |
double | ExpectedValueGet () const |
Get the expected value E[x] of the pdf. | |
Mixture (const unsigned int dimension=0) | |
Constructor: An equal weight is set for all components. | |
template<typename U > | |
Mixture (const U &componentVector) | |
Constructor: An equal weights is set for all components. | |
Mixture (const Mixture &my_mixture) | |
Copy Constructor. | |
int | MostProbableComponentGet () const |
Get the index of the most probable component, if a few component are. | |
unsigned int | NumComponentsGet () const |
Get the number of components. | |
Probability | ProbabilityGet (const T &state) const |
Implementation of virtual base class method. | |
bool | SampleFrom (vector< Sample< T > > &list_samples, const unsigned int num_samples, int method=DEFAULT, void *args=NULL) const |
bool | SampleFrom (Sample< T > &one_sample, int method=DEFAULT, void *args=NULL) const |
Probability | WeightGet (unsigned int componentNumber) const |
Get the component weight of component "componentNumber". | |
bool | WeightSet (unsigned int componentNumber, Probability w) |
Function to change/set the weigth of a single component. | |
vector< Probability > | WeightsGet () const |
Get all component weights. | |
bool | WeightsSet (vector< Probability > &weights) |
Set all component weights. | |
virtual | ~Mixture () |
Destructor. | |
Protected Member Functions | |
bool | CumWeightsUpdate () |
Updates the cumWeights. | |
bool | NormalizeWeights () |
Normalize the component weigths (eg. after setting a component weight) | |
void | TestNotInit () const |
Called when a the number of components=0 and if method is called which. | |
Protected Attributes | |
vector< Pdf< T > * > * | _componentPdfs |
Pointer to the vector of component pdfs. | |
vector< Probability > * | _componentWeights |
Pointer to the vector of mixture weights, the sum of the elements = 1. | |
vector< double > | _cumWeights |
Vector containing the cumulative component weights (for efficient sampling) | |
unsigned int | _numComponents |
The number of components. |
Class representing a mixture of PDFs, the mixture can contain different.
This class is an instantation from the template class Pdf, with added methods to get a set the individual components and mixture weights
BFL::Mixture< T >::Mixture | ( | const unsigned int | dimension = 0 | ) |
Constructor: An equal weight is set for all components.
dimension | the dimension of the state space |
Constructor: An equal weights is set for all components.
componentVector | vector of components (Pdf<T>*) |
BFL::Mixture< T >::Mixture | ( | const Mixture< T > & | my_mixture | ) |
Copy Constructor.
virtual BFL::Mixture< T >::~Mixture | ( | ) | [virtual] |
Destructor.
bool BFL::Mixture< T >::AddComponent | ( | Pdf< T > & | ) |
Add a component pdf: THIS IS A NON-REALTIME OPERATION.
Component pdf which will be added |
bool BFL::Mixture< T >::AddComponent | ( | Pdf< T > & | pdf, |
Probability | w | ||
) |
Add a component pdf with weight w: THIS IS A NON-REALTIME OPERATION.
Component pdf which will be added | |
weight | the weight of the new component |
virtual Mixture* BFL::Mixture< T >::Clone | ( | ) | const [virtual] |
Clone function.
Implements BFL::BFL::Pdf< T >.
Pdf<T>* BFL::Mixture< T >::ComponentGet | ( | unsigned int | componentNumber | ) | const |
Get the pointer to the component pdf of component "componentNumber".
componentNumber | number of the component (must be >=0 and <_numComponents) |
vector<Pdf<T>* > BFL::Mixture< T >::ComponentsGet | ( | ) | const |
Get the vector of pointers to the component pdfs.
MatrixWrapper::SymmetricMatrix BFL::Mixture< T >::CovarianceGet | ( | ) | const [virtual] |
Get the Covariance Matrix E[(x - E[x])^2] of the Analytic pdf.
Get first order statistic (Covariance) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
bool BFL::Mixture< T >::CumWeightsUpdate | ( | ) | [protected] |
Updates the cumWeights.
bool BFL::Mixture< T >::DeleteComponent | ( | unsigned int | componentNumber | ) |
Delete a component pdf: THIS IS A NON_REALTIME OPERATION.
componentNumber | number of the component which will be deleted (must be >=0 and <_numComponents) |
ColumnVector BFL::Mixture< ColumnVector >::ExpectedValueGet | ( | ) | const [inline, virtual] |
Get the expected value E[x] of the pdf.
Get low order statistic (Expected Value) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
Definition at line 30 of file mixture.cpp.
unsigned int BFL::Mixture< unsigned int >::ExpectedValueGet | ( | ) | const [inline, virtual] |
Get the expected value E[x] of the pdf.
Get low order statistic (Expected Value) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
Definition at line 45 of file mixture.cpp.
int BFL::Mixture< int >::ExpectedValueGet | ( | ) | const [inline, virtual] |
Get the expected value E[x] of the pdf.
Get low order statistic (Expected Value) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
Definition at line 81 of file mixture.cpp.
T BFL::Mixture< T >::ExpectedValueGet | ( | ) | const [virtual] |
Get the expected value E[x] of the pdf.
Get low order statistic (Expected Value) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
double BFL::Mixture< double >::ExpectedValueGet | ( | ) | const [inline, virtual] |
Get the expected value E[x] of the pdf.
Get low order statistic (Expected Value) of this AnalyticPdf
Reimplemented from BFL::BFL::Pdf< T >.
Definition at line 115 of file mixture.cpp.
int BFL::Mixture< T >::MostProbableComponentGet | ( | ) | const |
Get the index of the most probable component, if a few component are.
bool BFL::Mixture< T >::NormalizeWeights | ( | ) | [protected] |
Normalize the component weigths (eg. after setting a component weight)
unsigned int BFL::Mixture< T >::NumComponentsGet | ( | ) | const |
Get the number of components.
Probability BFL::Mixture< T >::ProbabilityGet | ( | const T & | state | ) | const [virtual] |
Implementation of virtual base class method.
Reimplemented from BFL::BFL::Pdf< T >.
bool BFL::Mixture< T >::SampleFrom | ( | vector< Sample< T > > & | list_samples, |
const unsigned int | num_samples, | ||
int | method = DEFAULT , |
||
void * | args = NULL |
||
) | const |
bool BFL::Mixture< T >::SampleFrom | ( | Sample< T > & | one_sample, |
int | method = DEFAULT , |
||
void * | args = NULL |
||
) | const |
void BFL::Mixture< T >::TestNotInit | ( | ) | const [protected] |
Called when a the number of components=0 and if method is called which.
Probability BFL::Mixture< T >::WeightGet | ( | unsigned int | componentNumber | ) | const |
Get the component weight of component "componentNumber".
componentNumber | number of the component (must be >=0 and <_numComponents) |
bool BFL::Mixture< T >::WeightSet | ( | unsigned int | componentNumber, |
Probability | w | ||
) |
Function to change/set the weigth of a single component.
Changes the component weights such that AFTER normalization the weight of the component "componentNumber" is equal to the weight w
componentNumber | number of the component of which the weight will be set (must be >=0 and <_numComponents) |
w | Probability to which the weight of component "componentNumber" will be set (must be <= 1) |
vector<Probability> BFL::Mixture< T >::WeightsGet | ( | ) | const |
Get all component weights.
bool BFL::Mixture< T >::WeightsSet | ( | vector< Probability > & | weights | ) |
Set all component weights.
values vector<Probability> containing the new component weights . The sum of the probabilities of this list is not required to be one since the normalization is automatically carried out. The size of weights should be equal to the number of components
vector<Pdf<T>* >* BFL::Mixture< T >::_componentPdfs [protected] |
vector<Probability>* BFL::Mixture< T >::_componentWeights [protected] |
vector<double> BFL::Mixture< T >::_cumWeights [protected] |
unsigned int BFL::Mixture< T >::_numComponents [protected] |