MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
mds::math::CMaxLikelihoodByEM< C, N > Class Template Reference

Gaussian Mixture Model (GMM) optimization using maximal likelihood estimation via the Expection-Maximization (EM) algorithm. More...

#include <mdsEM.h>

Inheritance diagram for mds::math::CMaxLikelihoodByEM< C, N >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { NO_ITERATOR_IS_DECLARED_FOR_TEMPLATE_PARAMETER = C::ITERATOR_DECLARED }
 Check that C has an iterator declared. More...
enum  { NUM_OF_DIMENSIONS = N }
 Dimensionality of input data. More...
typedef CGaussianFunc< double, NtComponent
 Gaussian function.
typedef C::tConstIterator tConstIterator
 Container iterator type.
typedef C tContainer
 Container type.
typedef CVector< double > tVector
 Used internal vector type.

Public Member Functions

CHasOptionsaddOption (int Flag)
 Adds a given flag using bitwise OR operation.
bool checkAllOptions (int Flags) const
 Checks if all specified flags are set.
bool checkAnyOption (int Flags) const
 Checks if any of specified flags is set.
int checkOption (int Flag) const
 Checks if a single flag is set.
CHasOptionsclearOption (int Flag)
 Removes a given flag.
 CMaxLikelihoodByEM (int Flags=MaxLikelihoodByEM::DEFAULT_FLAGS)
 Default constructor.
bool execute (const tContainer &Input)
 Estimates GMM of input data.
bool execute (const tContainer &Input, tSize NumOfClasses)
 Estimates GMM of input data.
const tComponentgetComponent (tSize i) const
 Returns reference to the i-th gaussian component.
tComponentgetComponent (tSize i)
bool getMembership (tSize i, tVector &Membership)
 Returns soft membership function of the i-th input sample.
tSize getMembership (tSize i)
 Returns index of the component into which the i-th input vector was classified (hard membership function).
tSize getNumOfComponents () const
 Returns the number of components.
tSize getNumOfDimensions () const
 Returns the number od dimensions.
int getOptions () const
 Returns all flags.
CMaxLikelihoodByEMsetMinAddChange (double dValue)
 Changes the minimal required change of the log-likelihood function which results in a new component addition.
CHasOptionssetOption (int Flag)
 Adds a given flag using bitwise OR operation.
CHasOptionssetOptions (int Flags)
 Sets complete flags.
virtual ~CMaxLikelihoodByEM ()
 Virtual destructor.

Protected Types

typedef std::vector< tComponenttComponents
 Gaussian functions representing mixture components/segments.
typedef tComponent::tVector tCov
 Diagonal of the gaussian component covariance matrix.
typedef CMatrix< double > tMaps
 Support maps.
typedef tComponent::tVector tMean
 Gaussian component mean.

Protected Member Functions

void addRandomNoise (double dNoiseCoeff)
 Add random noise to i-th component.
bool areSeparated (tSize i, tSize j, int c)
 Checks degree of separation of two given components.
bool checkForSimilarComponents ()
 Checks for similar components.
void clearSupportMaps ()
 Clears all support maps.
double computeLogLikelihood (const tContainer &Input)
 Returns value of the objective function.
double computeMDL (double dLogLikelihood, tSize NumOfSamples)
 Compute the MDL (Minimum Descriptive Length) coefficient.
tSize findComponent ()
 Finds component which can be further splitted.
int getDegreeOfSeparation (tSize NumOfComponents)
 Returns degree of separation.
void initComponentCov (tSize i)
 Intialization of a component covariance matrix.
void initComponentMean (tSize i, const tContainer &Input)
 Random intialization of i-th component mean value.
void initComponentWeight (tSize i, double dWeight)
 Intialization of a component weight.
bool initFirstComponent (const tContainer &Input)
 Initialization of the first mixture component.
double iterateEM (const tContainer &Input, double dMinChange)
 Iterates both E-step and M-step.
void processEStep (const tContainer &Input)
 E-step of the algorithm.
void processMStep (const tContainer &Input)
 M-step of the algorithm.
void splitComponent (tSize Index, tSize NewIndex)
 Splits a given component.

Protected Attributes

tComponents m_Components
 Mixture model components.
double m_dMinAddChange
 Minimal required change of the log-likelihood function which results in component addition.
tMaps m_Maps
 Support maps.
CNormalPRNG m_Normal
 Random number generator with normal distribution.
int m_Options
 Optional flags.
CUniformPRNG m_Uniform
 Uniform random number generator.

Detailed Description

template<class C, tSize N>
class mds::math::CMaxLikelihoodByEM< C, N >

Gaussian Mixture Model (GMM) optimization using maximal likelihood estimation via the Expection-Maximization (EM) algorithm.


Member Typedef Documentation

template<class C , tSize N>
typedef CGaussianFunc<double,N> mds::math::CMaxLikelihoodByEM< C, N >::tComponent

Gaussian function.

template<class C , tSize N>
typedef std::vector<tComponent> mds::math::CMaxLikelihoodByEM< C, N >::tComponents [protected]

Gaussian functions representing mixture components/segments.

template<class C , tSize N>
typedef C::tConstIterator mds::math::CMaxLikelihoodByEM< C, N >::tConstIterator

Container iterator type.

template<class C , tSize N>
typedef C mds::math::CMaxLikelihoodByEM< C, N >::tContainer

Container type.

template<class C , tSize N>
typedef tComponent::tVector mds::math::CMaxLikelihoodByEM< C, N >::tCov [protected]

Diagonal of the gaussian component covariance matrix.

template<class C , tSize N>
typedef CMatrix<double> mds::math::CMaxLikelihoodByEM< C, N >::tMaps [protected]

Support maps.

template<class C , tSize N>
typedef tComponent::tVector mds::math::CMaxLikelihoodByEM< C, N >::tMean [protected]

Gaussian component mean.

template<class C , tSize N>
typedef CVector<double> mds::math::CMaxLikelihoodByEM< C, N >::tVector

Used internal vector type.


Member Enumeration Documentation

template<class C , tSize N>
anonymous enum

Check that C has an iterator declared.

You will see name of this enum somewhere in compiler error message if the type C can't be used with iterators.

Enumerator:
NO_ITERATOR_IS_DECLARED_FOR_TEMPLATE_PARAMETER 
template<class C , tSize N>
anonymous enum

Dimensionality of input data.

Enumerator:
NUM_OF_DIMENSIONS 

Constructor & Destructor Documentation

Default constructor.

template<class C , tSize N>
virtual mds::math::CMaxLikelihoodByEM< C, N >::~CMaxLikelihoodByEM ( ) [virtual]

Virtual destructor.


Member Function Documentation

Adds a given flag using bitwise OR operation.

template<class C , tSize N>
void CMaxLikelihoodByEM::addRandomNoise ( double  dNoiseCoeff) [protected]

Add random noise to i-th component.

template<class C , tSize N>
bool CMaxLikelihoodByEM::areSeparated ( tSize  i,
tSize  j,
int  c 
) [protected]

Checks degree of separation of two given components.

bool mds::base::CHasOptions::checkAllOptions ( int  Flags) const [inherited]

Checks if all specified flags are set.

bool mds::base::CHasOptions::checkAnyOption ( int  Flags) const [inherited]

Checks if any of specified flags is set.

template<class C , tSize N>
bool CMaxLikelihoodByEM::checkForSimilarComponents ( ) [protected]

Checks for similar components.

  • If there are two similar components, one of them is re-initialized.
int mds::base::CHasOptions::checkOption ( int  Flag) const [inherited]

Checks if a single flag is set.

  • Returns zero on false.

Removes a given flag.

template<class C , tSize N>
void CMaxLikelihoodByEM::clearSupportMaps ( ) [protected]

Clears all support maps.

template<class C , tSize N>
double CMaxLikelihoodByEM::computeLogLikelihood ( const tContainer Input) [protected]

Returns value of the objective function.

template<class C , tSize N>
double CMaxLikelihoodByEM::computeMDL ( double  dLogLikelihood,
tSize  NumOfSamples 
) [protected]

Compute the MDL (Minimum Descriptive Length) coefficient.

template<class C , tSize N>
bool CMaxLikelihoodByEM::execute ( const tContainer Input)

Estimates GMM of input data.

  • Return false on failure.
template<class C , tSize N>
bool CMaxLikelihoodByEM::execute ( const tContainer Input,
tSize  NumOfClasses 
)

Estimates GMM of input data.

  • Fixed number of mixture components.
  • Return false on failure.
template<class C , tSize N>
tSize CMaxLikelihoodByEM::findComponent ( ) [protected]

Finds component which can be further splitted.

  • Returns index of such componnet.
template<class C , tSize N>
const tComponent& mds::math::CMaxLikelihoodByEM< C, N >::getComponent ( tSize  i) const

Returns reference to the i-th gaussian component.

  • Method can be called after successfull clustering!
template<class C , tSize N>
tComponent& mds::math::CMaxLikelihoodByEM< C, N >::getComponent ( tSize  i)
template<class C , tSize N>
int CMaxLikelihoodByEM::getDegreeOfSeparation ( tSize  NumOfComponents) [protected]

Returns degree of separation.

template<class C , tSize N>
bool CMaxLikelihoodByEM::getMembership ( tSize  i,
tVector Membership 
)

Returns soft membership function of the i-th input sample.

  • Method can be called after successfull clustering!
template<class C , tSize N>
tSize CMaxLikelihoodByEM::getMembership ( tSize  i)

Returns index of the component into which the i-th input vector was classified (hard membership function).

  • Method can be called after successfull clustering!
template<class C , tSize N>
tSize mds::math::CMaxLikelihoodByEM< C, N >::getNumOfComponents ( ) const

Returns the number of components.

  • Method can be called after successfull clustering!
template<class C , tSize N>
tSize mds::math::CMaxLikelihoodByEM< C, N >::getNumOfDimensions ( ) const

Returns the number od dimensions.

int mds::base::CHasOptions::getOptions ( ) const [inherited]

Returns all flags.

template<class C , tSize N>
void CMaxLikelihoodByEM::initComponentCov ( tSize  i) [protected]

Intialization of a component covariance matrix.

template<class C , tSize N>
void CMaxLikelihoodByEM::initComponentMean ( tSize  i,
const tContainer Input 
) [protected]

Random intialization of i-th component mean value.

template<class C , tSize N>
void CMaxLikelihoodByEM::initComponentWeight ( tSize  i,
double  dWeight 
) [protected]

Intialization of a component weight.

template<class C , tSize N>
bool CMaxLikelihoodByEM::initFirstComponent ( const tContainer Input) [protected]

Initialization of the first mixture component.

template<class C , tSize N>
double CMaxLikelihoodByEM::iterateEM ( const tContainer Input,
double  dMinChange 
) [protected]

Iterates both E-step and M-step.

  • Returns final value of the log-likelihood function
template<class C , tSize N>
void CMaxLikelihoodByEM::processEStep ( const tContainer Input) [protected]

E-step of the algorithm.

template<class C , tSize N>
void CMaxLikelihoodByEM::processMStep ( const tContainer Input) [protected]

M-step of the algorithm.

template<class C , tSize N>
CMaxLikelihoodByEM< C, N > & CMaxLikelihoodByEM::setMinAddChange ( double  dValue)

Changes the minimal required change of the log-likelihood function which results in a new component addition.

Adds a given flag using bitwise OR operation.

Sets complete flags.

template<class C , tSize N>
void CMaxLikelihoodByEM::splitComponent ( tSize  Index,
tSize  NewIndex 
) [protected]

Splits a given component.


Member Data Documentation

template<class C , tSize N>
tComponents mds::math::CMaxLikelihoodByEM< C, N >::m_Components [protected]

Mixture model components.

template<class C , tSize N>
double mds::math::CMaxLikelihoodByEM< C, N >::m_dMinAddChange [protected]

Minimal required change of the log-likelihood function which results in component addition.

template<class C , tSize N>
tMaps mds::math::CMaxLikelihoodByEM< C, N >::m_Maps [protected]

Support maps.

template<class C , tSize N>
CNormalPRNG mds::math::CMaxLikelihoodByEM< C, N >::m_Normal [protected]

Random number generator with normal distribution.

int mds::base::CHasOptions::m_Options [protected, inherited]

Optional flags.

template<class C , tSize N>
CUniformPRNG mds::math::CMaxLikelihoodByEM< C, N >::m_Uniform [protected]

Uniform random number generator.


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