Name
create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm — Create a Gaussian Mixture Model for classification
Herror create_class_gmm(const Hlong NumDim, const Hlong NumClasses, const Hlong NumCenters, const char* CovarType, const char* Preprocessing, const Hlong NumComponents, const Hlong RandSeed, Hlong* GMMHandle)
Herror T_create_class_gmm(const Htuple NumDim, const Htuple NumClasses, const Htuple NumCenters, const Htuple CovarType, const Htuple Preprocessing, const Htuple NumComponents, const Htuple RandSeed, Htuple* GMMHandle)
Herror create_class_gmm(const HTuple& NumDim, const HTuple& NumClasses, const HTuple& NumCenters, const HTuple& CovarType, const HTuple& Preprocessing, const HTuple& NumComponents, const HTuple& RandSeed, Hlong* GMMHandle)
void HClassGmm::CreateClassGmm(const HTuple& NumDim, const HTuple& NumClasses, const HTuple& NumCenters, const HTuple& CovarType, const HTuple& Preprocessing, const HTuple& NumComponents, const HTuple& RandSeed)
void CreateClassGmm(const HTuple& NumDim, const HTuple& NumClasses, const HTuple& NumCenters, const HTuple& CovarType, const HTuple& Preprocessing, const HTuple& NumComponents, const HTuple& RandSeed, HTuple* GMMHandle)
void HClassGmm::HClassGmm(Hlong NumDim, Hlong NumClasses, const HTuple& NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HClassGmm::HClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HClassGmm::HClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const char* CovarType, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HClassGmm::CreateClassGmm(Hlong NumDim, Hlong NumClasses, const HTuple& NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HClassGmm::CreateClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const HString& CovarType, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HClassGmm::CreateClassGmm(Hlong NumDim, Hlong NumClasses, Hlong NumCenters, const char* CovarType, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed)
void HOperatorSetX.CreateClassGmm(
[in] VARIANT NumDim, [in] VARIANT NumClasses, [in] VARIANT NumCenters, [in] VARIANT CovarType, [in] VARIANT Preprocessing, [in] VARIANT NumComponents, [in] VARIANT RandSeed, [out] VARIANT* GMMHandle)
void HClassGmmX.CreateClassGmm(
[in] Hlong NumDim, [in] Hlong NumClasses, [in] VARIANT NumCenters, [in] BSTR CovarType, [in] BSTR Preprocessing, [in] Hlong NumComponents, [in] Hlong RandSeed)
static void HOperatorSet.CreateClassGmm(HTuple numDim, HTuple numClasses, HTuple numCenters, HTuple covarType, HTuple preprocessing, HTuple numComponents, HTuple randSeed, out HTuple GMMHandle)
public HClassGmm(int numDim, int numClasses, HTuple numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
public HClassGmm(int numDim, int numClasses, int numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
void HClassGmm.CreateClassGmm(int numDim, int numClasses, HTuple numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
void HClassGmm.CreateClassGmm(int numDim, int numClasses, int numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm creates a Gaussian Mixture Model (GMM) for
classification. NumDimNumDimNumDimNumDimNumDimnumDim specifies the number of dimensions
of the feature space, NumClassesNumClassesNumClassesNumClassesNumClassesnumClasses specifies the number of
classes. A GMM consists of NumCentersNumCentersNumCentersNumCentersNumCentersnumCenters Gaussian
centers per class. NumCentersNumCentersNumCentersNumCentersNumCentersnumCenters can not only be the exact
number of centers to be used, but, depending on the number of
parameters, can specify upper and lower bounds for the number of
centers:
- exactly one parameter:
The parameter determines the exact
number of centers to be used for all classes.
- exactly two parameters:
The first parameter determines the
mimimum number of centers, the second determines the maximum
number of centers for all classes.
- exactly 2*NumClassesNumClassesNumClassesNumClassesNumClassesnumClasses parameters:
Alternatingly every first parameter determines the minimum number of
centers per class and every second parameters determines the maximum
number of centers per class.
When upper and lower bounds are specified, the optimum number of
centers will be determined with the help of the Mimimum Message
Length Criterion (MML). In general, we recommend to start the
training with (too) many centers as maximum and the
expected number of centers as minimum.
Each center is described by the parameters center m_j, covariance matrix C_j, and mixing
coefficient P_j. These parameters are calculated from
the training data by means of the Expectation Maximization (EM)
algorithm. A GMM can approximate an arbitrary probability density,
provided that enough centers are being used. The covariance matrices
C_j have the dimensions NumDimNumDimNumDimNumDimNumDimnumDim
x NumDimNumDimNumDimNumDimNumDimnumDim (NumComponentsNumComponentsNumComponentsNumComponentsNumComponentsnumComponents
x NumComponentsNumComponentsNumComponentsNumComponentsNumComponentsnumComponents if preprocessing is used) and
are symmetric. Further constraints can be given by
CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType:
For CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType = 'spherical'"spherical""spherical""spherical""spherical""spherical", C_j is a scalar multiple of the identity matrix C_j =
s_j^2 * I. The center density
function p(x|j) is
1 / || x-m_j ||^2 \
p(x|j) = ------------------------ exp | - --------------- |
( (2 pi s_j^2) )^(d/2) \ 2 s_j^2 /
For CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType = 'diag'"diag""diag""diag""diag""diag", C_j
is a diagonal matrix C_j = diag ( s_(j,1)^2,...,s_(j,d)^2
). The
center density function p(x|j) is
1
p(x|j) = ----------------------------------------- *
__d
(2 pi)^(d/2) ( || s_(j,i)^2 ) )^(1/2)
i=1
d
/ ---- \
| \ ( x_i - m_(j,i) )^2 |
exp | - / ----------------------- |
| ---- 2 s_j^2 |
\ i=1 /
For CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType = 'full'"full""full""full""full""full", C_j
is a positive definite matrix. The center density function
p(x|j) is
1
p(x|j) = -------------------------- *
(2 pi)^(d/2) |C_j|^(1/2)
/ 1 \
exp | - - ( x - m_j )^T C^(-1) ( x-m_j ) |
\ 2 /
The complexity of the calculations increases from CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType
= 'spherical'"spherical""spherical""spherical""spherical""spherical" over CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType = 'diag'"diag""diag""diag""diag""diag"
to CovarTypeCovarTypeCovarTypeCovarTypeCovarTypecovarType = 'full'"full""full""full""full""full". At the same time the
flexibility of the centers increases. In general,
'spherical'"spherical""spherical""spherical""spherical""spherical" therefore needs higher values for
NumCentersNumCentersNumCentersNumCentersNumCentersnumCenters than 'full'"full""full""full""full""full".
The procedure to use GMM is as follows: First, a GMM is created by
create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm. Then, training vectors are added by
add_sample_class_gmmadd_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm, afterwards they can be written to disk
with write_samples_class_gmmwrite_samples_class_gmmWriteSamplesClassGmmwrite_samples_class_gmmWriteSamplesClassGmmWriteSamplesClassGmm. With train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm
the classifier center parameters (defined above) are determined.
Furthermore, they can be saved with write_class_gmmwrite_class_gmmWriteClassGmmwrite_class_gmmWriteClassGmmWriteClassGmm for
later classifications.
From the mixing probabilities P_j and the
center density function p(x|j), the probability
density function p(x) can be calculated by:
n_comp
----
\
p(x) = / P(j) p(x|j)
----
j=1
The probability density function p(x) can be
evaluated with evaluate_class_gmmevaluate_class_gmmEvaluateClassGmmevaluate_class_gmmEvaluateClassGmmEvaluateClassGmm for a feature
vector x. classify_class_gmmclassify_class_gmmClassifyClassGmmclassify_class_gmmClassifyClassGmmClassifyClassGmm sorts the
p(x) and therefore discovers the most probable
class of the feature vector.
The parameters PreprocessingPreprocessingPreprocessingPreprocessingPreprocessingpreprocessing and NumComponentsNumComponentsNumComponentsNumComponentsNumComponentsnumComponents can
be used to preprocess the training data and reduce its dimensions.
These parameters are explained in the description of the operator
create_class_mlpcreate_class_mlpCreateClassMlpcreate_class_mlpCreateClassMlpCreateClassMlp.
create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm initializes the coordinates of the centers
with random numbers. To ensure that the results of training the
classifier with train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm are reproducible, the seed
value of the random number generator is passed in
RandSeedRandSeedRandSeedRandSeedRandSeedrandSeed.
- Multithreading type: exclusive (runs in parallel only with independent operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Number of dimensions of the feature space.
Default value: 3
Suggested values: 1, 2, 3, 4, 5, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100
Restriction: NumDim >= 1
Number of classes of the GMM.
Default value: 5
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Restriction: NumClasses >= 1
Number of centers per class.
Default value: 1
Suggested values: 1, 2, 3, 4, 5, 8, 10, 15, 20, 30
Restriction: NumClasses >= 1
Type of the covariance matrices.
Default value:
'spherical'
"spherical"
"spherical"
"spherical"
"spherical"
"spherical"
List of values: 'diag'"diag""diag""diag""diag""diag", 'full'"full""full""full""full""full", 'spherical'"spherical""spherical""spherical""spherical""spherical"
Type of preprocessing used to transform the
feature vectors.
Default value:
'normalization'
"normalization"
"normalization"
"normalization"
"normalization"
"normalization"
List of values: 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates", 'none'"none""none""none""none""none", 'normalization'"normalization""normalization""normalization""normalization""normalization", 'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components"
Preprocessing parameter: Number of transformed
features (ignored for PreprocessingPreprocessingPreprocessingPreprocessingPreprocessingpreprocessing
= 'none'"none""none""none""none""none" and PreprocessingPreprocessingPreprocessingPreprocessingPreprocessingpreprocessing
= 'normalization'"normalization""normalization""normalization""normalization""normalization").
Default value: 10
Suggested values: 1, 2, 3, 4, 5, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100
Restriction: NumComponents >= 1
Seed value of the random number generator that
is used to initialize the GMM with random
values.
Default value: 42
* Classification with Gaussian Mixture Models
create_class_gmm (NumDim , NumClasses, [1,5], 'full', 'none',\
NumComponents, 42, GMMHandle)
* Add the training data
for J := 0 to NData-1 by 1
* Features := [...]
* ClassID := [...]
add_sample_class_gmm (GMMHandle, Features, ClassID, Randomize)
endfor
* Train the GMM
train_class_gmm (GMMHandle, 100, 0.001, 'training', 0.0001, Centers, Iter)
* Classify unknown data in 'Features'
classify_class_gmm (GMMHandle, Features, 1, ID, Prob, Density, KSigmaProb)
clear_class_gmm (GMMHandle)
If the parameters are valid, the operator create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm
returns the value 2 (H_MSG_TRUE). If necessary an exception is
raised.
add_sample_class_gmmadd_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm,
add_samples_image_class_gmmadd_samples_image_class_gmmAddSamplesImageClassGmmadd_samples_image_class_gmmAddSamplesImageClassGmmAddSamplesImageClassGmm
create_class_mlpcreate_class_mlpCreateClassMlpcreate_class_mlpCreateClassMlpCreateClassMlp,
create_class_svmcreate_class_svmCreateClassSvmcreate_class_svmCreateClassSvmCreateClassSvm,
create_class_boxcreate_class_boxCreateClassBoxcreate_class_boxCreateClassBoxCreateClassBox
clear_class_gmmclear_class_gmmClearClassGmmclear_class_gmmClearClassGmmClearClassGmm,
train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm,
classify_class_gmmclassify_class_gmmClassifyClassGmmclassify_class_gmmClassifyClassGmmClassifyClassGmm,
evaluate_class_gmmevaluate_class_gmmEvaluateClassGmmevaluate_class_gmmEvaluateClassGmmEvaluateClassGmm,
classify_image_class_gmmclassify_image_class_gmmClassifyImageClassGmmclassify_image_class_gmmClassifyImageClassGmmClassifyImageClassGmm
Christopher M. Bishop: “Neural Networks for Pattern Recognition”;
Oxford University Press, Oxford; 1995.
Mario A.T. Figueiredo: “Unsupervised Learning of Finite Mixture
Models”; IEEE Transactions on Pattern Analysis and Machine
Intelligence, Vol. 24, No. 3; March 2002.
Foundation