libcrn
3.9.5
A document image processing library
|
Multivariate gaussian mixture. More...
#include <CRNMultivariateGaussianMixture.h>
Public Member Functions | |
MultivariateGaussianMixture () | |
Default constructor. More... | |
MultivariateGaussianMixture (size_t d) | |
Default constructor. More... | |
MultivariateGaussianMixture (const MultivariateGaussianMixture &)=default | |
MultivariateGaussianMixture (MultivariateGaussianMixture &&)=default | |
template<typename ITER > | |
MultivariateGaussianMixture (ITER it_begin, ITER it_end, size_t nb_seeds=2) | |
MultivariateGaussianMixture & | operator= (const MultivariateGaussianMixture &)=default |
MultivariateGaussianMixture & | operator= (MultivariateGaussianMixture &&)=default |
virtual | ~MultivariateGaussianMixture () override |
Destructor. More... | |
void | SetTo (const MultivariateGaussianMixture &m) |
Set mixture from another one. More... | |
size_t | GetDimension () const noexcept |
Returns the number of features. More... | |
void | SetDimension (size_t k) noexcept |
Sets the number of features. More... | |
size_t | GetNbMembers () const noexcept |
Returns the number of density functions. More... | |
double | GetWeight (size_t k) const |
Returns the weight of a given density function. More... | |
MultivariateGaussianPDF | GetMember (size_t k) const |
Returns a given density function. More... | |
MatrixDouble | GetMean (size_t k) const |
Returns the mean of a given density function. More... | |
SquareMatrixDouble | GetVariance (size_t k) const |
Returns the variance of a given density function. More... | |
void | AddMember (const MultivariateGaussianPDF &pdf, double Weight) |
Adds a density function. More... | |
void | SetMember (const MultivariateGaussianPDF &pdf, double w, size_t k) |
Replaces a given density function and its weight. More... | |
double | ValueAt (const MatrixDouble &X) const |
Evaluates a pattern. More... | |
double | ValueAt (const MatrixDouble &X, size_t k, bool w=false) const |
Evaluates a pattern for a given density function. More... | |
double | ValueAt (const std::vector< double > &x, size_t k, bool w=false) const |
Evaluates a pattern for a given density function. More... | |
unsigned int | EM (const MatrixDouble &patterns, size_t nbSeeds=2, double epsilon=std::numeric_limits< double >::epsilon(), size_t MaximalIterations=100) |
Expectation Maximization. More... | |
unsigned int | EM (const std::vector< std::vector< double > > &patterns, size_t nbSeeds=2, double epsilon=std::numeric_limits< double >::epsilon(), size_t MaximalIterations=100) |
template<typename ITER > | |
unsigned int | EM (ITER it_begin, ITER it_end, size_t nbSeeds=2, double epsilon=std::numeric_limits< double >::epsilon(), size_t MaximalIterations=100) |
String | ToString () const |
Dumps a summary of the mixture to a string. More... | |
String | ToString (size_t k) const |
Dumps a summary of one element of the mixture to a string. More... | |
double | MLLE (const MatrixDouble &data) const |
Maximum log-likelihood estimation. More... | |
double | MLLE (const std::vector< std::vector< double > > &data) const |
Maximum log-likelihood estimation. More... | |
template<typename ITER > | |
double | MLLE (ITER it_begin, ITER it_end) const |
Maximum log-likelihood estimation. More... | |
bool | IsValid () const |
Test if mixture is valid i.e. if all paratemers have finite values. More... | |
![]() | |
virtual | ~Object ()=default |
Multivariate gaussian mixture.
Model for multivariate gaussian mixture
Definition at line 43 of file CRNMultivariateGaussianMixture.h.
|
inline |
Default constructor.
Definition at line 47 of file CRNMultivariateGaussianMixture.h.
|
inline |
Default constructor.
Definition at line 49 of file CRNMultivariateGaussianMixture.h.
|
default |
|
default |
|
inline |
Create a gaussian mixture to model a given set of data
[in] | it_begin | iterator pointing to first (vector of double, size_t) pair of input data |
[in] | it_end | ending iterator |
[in] | nbSeeds | the number of density functions |
Definition at line 62 of file CRNMultivariateGaussianMixture.h.
|
overridevirtual |
void MultivariateGaussianMixture::AddMember | ( | const MultivariateGaussianPDF & | pdf, |
double | w | ||
) |
Adds a density function.
Add a member in mixture
ExceptionDimension | incompatible dimensions |
[in] | spdf | gaussian PDF to add as new member |
[in] | w | Weight of the new member |
Definition at line 155 of file CRNMultivariateGaussianMixture.cpp.
unsigned int MultivariateGaussianMixture::EM | ( | const MatrixDouble & | patterns, |
size_t | nbSeeds = 2 , |
||
double | epsilon = std::numeric_limits<double>::epsilon() , |
||
size_t | maximalIterations = 100 |
||
) |
Expectation Maximization.
Expectation-Maximization algorithm for Gaussian mixture estimation optimization
[in] | patterns | set of patterns stored as rows of a data matrix |
[in] | nbSeeds | the number of density functions |
[in] | epsilon | the minimum likelihood gain between two iterations |
[in] | maximalIterations | the maximum number of iterations |
Definition at line 324 of file CRNMultivariateGaussianMixture.cpp.
unsigned int MultivariateGaussianMixture::EM | ( | const std::vector< std::vector< double > > & | patterns, |
size_t | nbSeeds = 2 , |
||
double | epsilon = std::numeric_limits<double>::epsilon() , |
||
size_t | maximalIterations = 100 |
||
) |
Expectation-Maximization algorithm for Gaussian mixture estimation optimization
[in] | patterns | vector of patterns stored as vectors of doubles |
[in] | nbSeeds | the number of density functions |
[in] | epsilon | the minimum likelihood gain between two iterations |
[in] | maximalIterations | the maximum number of iterations |
Definition at line 495 of file CRNMultivariateGaussianMixture.cpp.
|
inline |
Expectation-Maximization algorithm for Gaussian mixture estimation optimization
[in] | it_begin | iterator pointing to first (vector of double, size_t) pair of input data |
[in] | it_end | ending iterator |
[in] | nbSeeds | the number of density functions |
[in] | epsilon | the minimum likelihood gain between two iterations |
[in] | maximalIterations | the maximum number of iterations |
Definition at line 122 of file CRNMultivariateGaussianMixture.h.
|
inlinenoexcept |
Returns the number of features.
Definition at line 79 of file CRNMultivariateGaussianMixture.h.
MatrixDouble MultivariateGaussianMixture::GetMean | ( | size_t | k | ) | const |
Returns the mean of a given density function.
Get mean for a member
ExceptionDomain | index out of bounds |
[in] | k | index of a density function % |
Definition at line 121 of file CRNMultivariateGaussianMixture.cpp.
MultivariateGaussianPDF MultivariateGaussianMixture::GetMember | ( | size_t | k | ) | const |
Returns a given density function.
Return a member
ExceptionDomain | index out of bounds |
[in] | k | index of the density function to return |
Definition at line 85 of file CRNMultivariateGaussianMixture.cpp.
|
inlinenoexcept |
Returns the number of density functions.
Definition at line 83 of file CRNMultivariateGaussianMixture.h.
SquareMatrixDouble MultivariateGaussianMixture::GetVariance | ( | size_t | k | ) | const |
Returns the variance of a given density function.
Get variance for a member
ExceptionDomain | index out of bounds |
[in] | k | index of a density function |
Definition at line 139 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::GetWeight | ( | size_t | k | ) | const |
Returns the weight of a given density function.
Get weight for a member
ExceptionDomain | index out of bounds |
[in] | k | index of a density function % |
Definition at line 103 of file CRNMultivariateGaussianMixture.cpp.
bool MultivariateGaussianMixture::IsValid | ( | ) | const |
Test if mixture is valid i.e. if all paratemers have finite values.
Test if mixture is valid i.e. if all paratemers have finite values
Definition at line 708 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::MLLE | ( | const MatrixDouble & | Data | ) | const |
Maximum log-likelihood estimation.
Maximum log-likelihood estimator
[in] | Data | set of patterns stored as rows of a data matrix |
Definition at line 279 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::MLLE | ( | const std::vector< std::vector< double > > & | data | ) | const |
Maximum log-likelihood estimation.
Maximum log-likelihood estimator
[in] | Data | set of patterns stored as rows of a data matrix |
Definition at line 304 of file CRNMultivariateGaussianMixture.cpp.
|
inline |
Maximum log-likelihood estimation.
Definition at line 319 of file CRNMultivariateGaussianMixture.h.
|
default |
|
default |
|
noexcept |
Sets the number of features.
Set dimension
[in] | k | dimension of data space |
Definition at line 72 of file CRNMultivariateGaussianMixture.cpp.
void MultivariateGaussianMixture::SetMember | ( | const MultivariateGaussianPDF & | pdf, |
double | w, | ||
size_t | k | ||
) |
Replaces a given density function and its weight.
Replace a member in mixture
ExceptionDimension | incompatible dimensions |
ExceptionDomain | invalid index |
[in] | spdf | the new gaussian PDF |
[in] | w | the new weight |
[in] | k | index |
Definition at line 177 of file CRNMultivariateGaussianMixture.cpp.
void MultivariateGaussianMixture::SetTo | ( | const MultivariateGaussianMixture & | m | ) |
Set mixture from another one.
Set up parameters from another mixture's
[in] | *m | another mixture |
Definition at line 51 of file CRNMultivariateGaussianMixture.cpp.
String MultivariateGaussianMixture::ToString | ( | ) | const |
Dumps a summary of the mixture to a string.
Dump the mixture parameters to a string
Definition at line 665 of file CRNMultivariateGaussianMixture.cpp.
String MultivariateGaussianMixture::ToString | ( | size_t | k | ) | const |
Dumps a summary of one element of the mixture to a string.
Dump the parameters of one member in the mixture to a string
[in] | k | the index of the density function |
Definition at line 682 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::ValueAt | ( | const MatrixDouble & | X | ) | const |
Evaluates a pattern.
Evaluate a pattern
[in] | X | the column matrix to evaluate |
Definition at line 200 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::ValueAt | ( | const MatrixDouble & | X, |
size_t | k, | ||
bool | w = false |
||
) | const |
Evaluates a pattern for a given density function.
Evaluate a pattern only for one member of the mixture
ExceptionDomain | index out of bounds |
[in] | X | the column matrix to evaluate |
[in] | k | member index |
[in] | w | flag to indicate if weight is used |
Definition at line 221 of file CRNMultivariateGaussianMixture.cpp.
double MultivariateGaussianMixture::ValueAt | ( | const std::vector< double > & | x, |
size_t | k, | ||
bool | w = false |
||
) | const |
Evaluates a pattern for a given density function.
Evaluate a pattern only for one member of the mixture
ExceptionDomain | index out of bounds |
[in] | x | pattern vector to evaluate |
[in] | k | member index |
[in] | w | flag to indicate if weight is used |
Definition at line 251 of file CRNMultivariateGaussianMixture.cpp.