Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pbl::Mixture Class Reference

This class represents the weighted sum of a finite set of probability density functions. More...

#include <Mixture.h>

Inheritance diagram for pbl::Mixture:
Inheritance graph
[legend]

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...
 
Mixtureclone () 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 PDFgetComponent (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...
 
Mixtureoperator= (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

MixtureStructptr_
 
- 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
}
 

Detailed Description

This class represents the weighted sum of a finite set of probability density functions.

Author
Sjoerd van den Dries
Date
December, 2012
Version
1.0

Definition at line 54 of file Mixture.h.

Constructor & Destructor Documentation

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.

Mixture::~Mixture ( )
virtual

Destructor.

Definition at line 50 of file Mixture.cpp.

Member Function Documentation

void Mixture::addComponent ( const PDF pdf,
double  w 
)

Adds a component pdf with given weight.

Parameters
pdfThe component pdf
wWeight 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.

Mixture * Mixture::clone ( ) const
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.

void Mixture::cloneStruct ( )
protected

Definition at line 80 of file Mixture.cpp.

int Mixture::components ( ) const

Returns the number of components.

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.

Parameters
iIndex of the component
Returns
A reference to the i'th component

Definition at line 139 of file Mixture.cpp.

double Mixture::getLikelihood ( const PDF pdf) const
virtual

Implements pbl::PDF.

Definition at line 87 of file Mixture.cpp.

double Mixture::getMaxDensity ( ) const
virtual

NOT IMPLEMENTED FOR MIXTURE.

Implements pbl::PDF.

Definition at line 111 of file Mixture.cpp.

double Mixture::getWeight ( int  i) const

Returns the weight of the i'th component.

Parameters
iIndex of the component
Returns
The weight of the i'th 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.

Mixture & 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.

Definition at line 60 of file Mixture.cpp.

std::string Mixture::toString ( const std::string &  indent = "") const
virtual

Represents the Mixture as a string for easier console output.

Note
Should be changed into stream operator <<
Returns
The Gaussian as string

Implements pbl::PDF.

Definition at line 162 of file Mixture.cpp.

Member Data Documentation

MixtureStruct* pbl::Mixture::ptr_
protected

Definition at line 173 of file Mixture.h.


The documentation for this class was generated from the following files:


problib
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:19