Skip to content

evaluate_class_gmmEvaluateClassGmmEvaluateClassGmmevaluate_class_gmmT_evaluate_class_gmmπŸ”—

Short descriptionπŸ”—

evaluate_class_gmmEvaluateClassGmmEvaluateClassGmmevaluate_class_gmmT_evaluate_class_gmm β€” Evaluate a feature vector by a Gaussian Mixture Model.

SignatureπŸ”—

evaluate_class_gmm( class_gmm GMMHandle, real Features, out real ClassProb, out real Density, out real KSigmaProb )void EvaluateClassGmm( const HTuple& GMMHandle, const HTuple& Features, HTuple* ClassProb, HTuple* Density, HTuple* KSigmaProb )static void HOperatorSet.EvaluateClassGmm( HTuple GMMHandle, HTuple features, out HTuple classProb, out HTuple density, out HTuple KSigmaProb )def evaluate_class_gmm( gmmhandle: HHandle, features: Sequence[float] ) -> Tuple[Sequence[float], float, float]

Herror T_evaluate_class_gmm( const Htuple GMMHandle, const Htuple Features, Htuple* ClassProb, Htuple* Density, Htuple* KSigmaProb )

HTuple HClassGmm::EvaluateClassGmm( const HTuple& Features, double* Density, double* KSigmaProb ) const

HTuple HClassGmm.EvaluateClassGmm( HTuple features, out double density, out double KSigmaProb )

DescriptionπŸ”—

evaluate_class_gmmEvaluateClassGmm computes three different probability values for a feature vector Featuresfeaturesfeatures with the Gaussian Mixture Model (GMM) GMMHandleGMMHandlegmmhandle.

The a-posteriori probability of class i for the sample Featuresfeaturesfeatures(x) is computed as

\[\begin{eqnarray*} p(i|{\bf x})=\sum_{j = 1}^{n_{comp}} P(j) p({\bf x}|j) \end{eqnarray*}\]

and returned for each class in ClassProbclassProbclass_prob. The formulas for the calculation of the center density function p(x|j) are described with create_class_gmmCreateClassGmm.

The probability density of the feature vector is computed as a sum of the posterior class probabilities

\[\begin{eqnarray*} p({\bf x})=\sum_{i = 1}^{n_{classes}} Pr(i) p(i|{\bf x}) \end{eqnarray*}\]

and is returned in Densitydensitydensity. Here, Pr(i) are the prior classes probabilities as computed by train_class_gmmTrainClassGmm. Densitydensitydensity can be used for novelty detection, i.e., to reject feature vectors that do not belong to any of the trained classes. However, since Densitydensitydensity depends on the scaling of the feature vectors and since Densitydensitydensity is a probability density, and consequently does not need to lie between 0 and 1, the novelty detection can typically be performed more easily with KSigmaProbKSigmaProbksigma_prob (see below).

A k-sigma error ellipsoid is defined as a locus of points for which

\[\begin{eqnarray*}({\bf x} - \mu)^{T}C^{-1}({\bf x} - \mu) = k^2 \end{eqnarray*}\]

In the one dimensional case this is the interval \([\mu-k\sigma,\mu+k \sigma]\). For any 1D Gaussian distribution, it is true that approximately 68% of the occurrences of the random variable are within this range for \(k=1\), approximately 95% for \(k=2\), approximately 99% for \(k=3\), etc. This probability is called k-sigma probability and is denoted by \(P[k]\). \(P[k]\) can be computed numerically for univariate as well as for multivariate Gaussian distributions, where it should be noted that for the same values of \(k\), \(P^{(N)}[k] > P^{(N+1)}[k]\) (here N and (N+1) denote dimensions). For Gaussian mixture models the k-sigma probability is computed as:

\[\begin{eqnarray*} P_{GMM}[{\bf x}] = \sum_{j = 1}^{n_{comp}} P(j) P_{j}[k_{j}] \end{eqnarray*}\]


where

\[\begin{eqnarray*} k_{j}^2 = ({\bf x} - \mu_{j})^{T}C_{j}^{-1}({\bf x} - \mu_{j}) \end{eqnarray*}\]

. \(P_{GMM}[k]\) are weighted with the class priors and then normalized. The maximum value of all classes is returned in KSigmaProbKSigmaProbksigma_prob, such that

\[\begin{eqnarray*}\textrm{KSigmaProb} = \frac{1}{\Pr_{max}} \max{(Pr(i) P_{GMM}[{\bf x}])}\end{eqnarray*}\]

KSigmaProbKSigmaProbksigma_prob can be used for novelty detection, as it indicates how well a feature vector fits into the distribution of the class it is assigned to. Typically, feature vectors having values below 0.0001 should be rejected. Note that the rejection threshold defined by the parameter RejectionThresholdrejectionThresholdrejection_threshold in classify_image_class_gmmClassifyImageClassGmm refers to the KSigmaProbKSigmaProbksigma_prob values.

Before calling evaluate_class_gmmEvaluateClassGmm, the GMM must be trained with train_class_gmmTrainClassGmm.

The position of the maximum value of ClassProbclassProbclass_prob is usually interpreted as the class of the feature vector and the corresponding value as the probability of the class. In this case, classify_class_gmmClassifyClassGmm should be used instead of evaluate_class_gmmEvaluateClassGmm, because classify_class_gmmClassifyClassGmm directly returns the class and corresponding probability.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

GMMHandleGMMHandlegmmhandle (input_control) class_gmm β†’ (handle)HTuple (HHandle)HClassGmm, HTuple (IntPtr)HHandleHtuple (handle)

GMM handle.

Featuresfeaturesfeatures (input_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Feature vector.

ClassProbclassProbclass_prob (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

A-posteriori probability of the classes.

Densitydensitydensity (output_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Probability density of the feature vector.

KSigmaProbKSigmaProbksigma_prob (output_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Normalized k-sigma-probability for the feature vector.

ResultπŸ”—

If the parameters are valid, the operator evaluate_class_gmmEvaluateClassGmm returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

train_class_gmmTrainClassGmm, read_class_gmmReadClassGmm

Alternatives

classify_class_gmmClassifyClassGmm

See also

create_class_gmmCreateClassGmm

ReferencesπŸ”—

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.

ModuleπŸ”—

Foundation