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

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

#include <mdsWeightedEM.h>

Inheritance diagram for mds::img::CWeightedEM< 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
mds::math::CGaussianFunc
< double, N
tComponent
 Gaussian function.
typedef C::tConstIterator tConstIterator
 Container iterator type.
typedef C tContainer
 Container type.
typedef mds::math::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.
 CWeightedEM (int Flags=mds::math::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.
CWeightedEMsetMinAddChange (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 ~CWeightedEM ()
 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 mds::math::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, tSize NumOfSamples)
 Iterates both E-step and M-step.
void processEStep (const tContainer &Input)
 E-step of the algorithm.
void processMStep (const tContainer &Input, tSize NumOfSamples)
 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.
mds::math::CNormalPRNG m_Normal
 Random number generator with normal distribution.
int m_Options
 Optional flags.
mds::math::CUniformPRNG m_Uniform
 Uniform random number generator.

Detailed Description

template<class C, tSize N>
class mds::img::CWeightedEM< 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 mds::math::CGaussianFunc<double,N> mds::img::CWeightedEM< C, N >::tComponent

Gaussian function.

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

Gaussian functions representing mixture components/segments.

template<class C , tSize N>
typedef C::tConstIterator mds::img::CWeightedEM< C, N >::tConstIterator

Container iterator type.

template<class C , tSize N>
typedef C mds::img::CWeightedEM< C, N >::tContainer

Container type.

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

Diagonal of the gaussian component covariance matrix.

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

Support maps.

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

Gaussian component mean.

template<class C , tSize N>
typedef mds::math::CVector<double> mds::img::CWeightedEM< 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::img::CWeightedEM< C, N >::~CWeightedEM ( ) [virtual]

Virtual destructor.


Member Function Documentation

Adds a given flag using bitwise OR operation.

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

Add random noise to i-th component.

template<class C , tSize N>
bool CWeightedEM::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 CWeightedEM::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 CWeightedEM::clearSupportMaps ( ) [protected]

Clears all support maps.

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

Returns value of the objective function.

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

Compute the MDL (Minimum Descriptive Length) coefficient.

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

Estimates GMM of input data.

  • Return false on failure.
template<class C , tSize N>
bool CWeightedEM::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 CWeightedEM::findComponent ( ) [protected]

Finds component which can be further splitted.

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

Returns reference to the i-th gaussian component.

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

Returns degree of separation.

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

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

  • Method can be called after successfull clustering process!
template<class C , tSize N>
tSize CWeightedEM::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 process!
template<class C , tSize N>
tSize mds::img::CWeightedEM< C, N >::getNumOfComponents ( ) const

Returns the number of components.

  • Method can be called after successfull clustering process!
template<class C , tSize N>
tSize mds::img::CWeightedEM< 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 CWeightedEM::initComponentCov ( tSize  i) [protected]

Intialization of a component covariance matrix.

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

Random intialization of i-th component mean value.

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

Intialization of a component weight.

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

Initialization of the first mixture component.

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

Iterates both E-step and M-step.

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

E-step of the algorithm.

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

M-step of the algorithm.

template<class C , tSize N>
CWeightedEM< C, N > & CWeightedEM::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 CWeightedEM::splitComponent ( tSize  Index,
tSize  NewIndex 
) [protected]

Splits a given component.


Member Data Documentation

template<class C , tSize N>
tComponents mds::img::CWeightedEM< C, N >::m_Components [protected]

Mixture model components.

template<class C , tSize N>
double mds::img::CWeightedEM< 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::img::CWeightedEM< C, N >::m_Maps [protected]

Support maps.

template<class C , tSize N>
mds::math::CNormalPRNG mds::img::CWeightedEM< 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>
mds::math::CUniformPRNG mds::img::CWeightedEM< C, N >::m_Uniform [protected]

Uniform random number generator.


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