Documentation>C API
gmm.h File Reference

GMM (Gaussian Mixture Models (GMM)) More...

#include "kmeans.h"

Typedefs

typedef OPAQUE VlGMM
 GMM quantizer.
 

Enumerations

enum  VlGMMInitialization { VlGMMKMeans, VlGMMRand, VlGMMCustom }
 GMM initialization algorithms. More...
 

Functions

void vl_gmm_set_means (VlGMM *self, void const *means)
 Explicitly set the initial means for EM. More...
 
void vl_gmm_set_covariances (VlGMM *self, void const *covariances)
 Explicitly set the initial sigma diagonals for EM. More...
 
void vl_gmm_set_priors (VlGMM *self, void const *priors)
 Explicitly set the initial priors of the gaussians. More...
 
Create and destroy
VlGMMvl_gmm_new (vl_type dataType, vl_size dimension, vl_size numComponents)
 Create a new GMM object. More...
 
VlGMMvl_gmm_new_copy (VlGMM const *gmm)
 Create a new GMM object by copy. More...
 
void vl_gmm_delete (VlGMM *self)
 Deletes a GMM object. More...
 
void vl_gmm_reset (VlGMM *self)
 Reset state. More...
 
Basic data processing
double vl_gmm_cluster (VlGMM *self, void const *data, vl_size numData)
 Run GMM clustering - includes initialization and EM. More...
 
Fine grained data processing
void vl_gmm_init_with_rand_data (VlGMM *self, void const *data, vl_size numData)
 Initialize mixture before EM takes place using random initialization. More...
 
void vl_gmm_init_with_kmeans (VlGMM *self, void const *data, vl_size numData, VlKMeans *kmeansInit)
 Initializes the GMM using KMeans. More...
 
double vl_gmm_em (VlGMM *self, void const *data, vl_size numData)
 Invoke the EM algorithm. More...
 
Set parameters
void vl_gmm_set_num_repetitions (VlGMM *self, vl_size numRepetitions)
 Set maximum number of repetitions. More...
 
void vl_gmm_set_max_num_iterations (VlGMM *self, vl_size maxNumIterations)
 Set maximum number of iterations. More...
 
void vl_gmm_set_verbosity (VlGMM *self, int verbosity)
 Set verbosity level. More...
 
void vl_gmm_set_initialization (VlGMM *self, VlGMMInitialization init)
 Set initialization algorithm. More...
 
void vl_gmm_set_kmeans_init_object (VlGMM *self, VlKMeans *kmeans)
 Set KMeans initialization object. More...
 
void vl_gmm_set_covariance_lower_bounds (VlGMM *self, double const *bounds)
 Set the lower bounds on diagonal covariance values. More...
 
void vl_gmm_set_covariance_lower_bound (VlGMM *self, double bound)
 Set the lower bounds on diagonal covariance values. More...
 
Get parameters
void const * vl_gmm_get_means (VlGMM const *self)
 Get means. More...
 
void const * vl_gmm_get_covariances (VlGMM const *self)
 Get covariances. More...
 
void const * vl_gmm_get_priors (VlGMM const *self)
 Get priors. More...
 
void const * vl_gmm_get_posteriors (VlGMM const *self)
 Get posteriors. More...
 
vl_type vl_gmm_get_data_type (VlGMM const *self)
 Get data type. More...
 
vl_size vl_gmm_get_dimension (VlGMM const *self)
 Get data dimension. More...
 
vl_size vl_gmm_get_num_repetitions (VlGMM const *self)
 Get maximum number of repetitions. More...
 
vl_size vl_gmm_get_num_data (VlGMM const *self)
 Get the number of data points. More...
 
vl_size vl_gmm_get_num_clusters (VlGMM const *self)
 Get the number of clusters. More...
 
double vl_gmm_get_loglikelihood (VlGMM const *self)
 Get the log likelihood of the current mixture. More...
 
int vl_gmm_get_verbosity (VlGMM const *self)
 Get verbosity level. More...
 
vl_size vl_gmm_get_max_num_iterations (VlGMM const *self)
 Get maximum number of iterations. More...
 
VlGMMInitialization vl_gmm_get_initialization (VlGMM const *self)
 Get initialization algorithm. More...
 
VlKMeansvl_gmm_get_kmeans_init_object (VlGMM const *self)
 Get KMeans initialization object. More...
 
double const * vl_gmm_get_covariance_lower_bounds (VlGMM const *self)
 Get the lower bound on the diagonal covariance values. More...
 

Detailed Description

Author
David Novotny
Andrea Vedaldi

Enumeration Type Documentation

Enumerator
VlGMMKMeans 

Initialize GMM from KMeans clustering.

VlGMMRand 

Initialize GMM parameters by selecting points at random.

VlGMMCustom 

User specifies the initial GMM parameters.

Function Documentation

double vl_gmm_cluster ( VlGMM self,
void const *  data,
vl_size  numData 
)
Parameters
selfGMM object instance.
datadata points which should be clustered.
numDatanumber of data points.
void vl_gmm_delete ( VlGMM self)
Parameters
selfGMM object instance.

The function deletes the GMM object instance created by vl_gmm_new.

double vl_gmm_em ( VlGMM self,
void const *  data,
vl_size  numData 
)
Parameters
selfGMM object instance.
datadata points which should be clustered.
numDatanumber of data points.
double const* vl_gmm_get_covariance_lower_bounds ( VlGMM const *  self)
Parameters
selfobject
Returns
lower bound on covariances.
void const* vl_gmm_get_covariances ( VlGMM const *  self)
Parameters
selfobject
Returns
diagonals of cluster covariance matrices.
vl_type vl_gmm_get_data_type ( VlGMM const *  self)
Parameters
selfobject
Returns
data type.
vl_size vl_gmm_get_dimension ( VlGMM const *  self)
Parameters
selfobject
Returns
data dimension.
VlGMMInitialization vl_gmm_get_initialization ( VlGMM const *  self)
Parameters
selfobject
Returns
initialization algorithm.
VlKMeans* vl_gmm_get_kmeans_init_object ( VlGMM const *  self)
Parameters
selfobject
Returns
kmeans initialization object.
double vl_gmm_get_loglikelihood ( VlGMM const *  self)
Parameters
selfobject
Returns
loglikelihood.
vl_size vl_gmm_get_max_num_iterations ( VlGMM const *  self)
Parameters
selfobject
Returns
maximum number of iterations.
void const* vl_gmm_get_means ( VlGMM const *  self)
Parameters
selfobject
Returns
cluster means.
vl_size vl_gmm_get_num_clusters ( VlGMM const *  self)
Parameters
selfobject
Returns
number of clusters.
vl_size vl_gmm_get_num_data ( VlGMM const *  self)
Parameters
selfobject
Returns
number of data points.
vl_size vl_gmm_get_num_repetitions ( VlGMM const *  self)
Parameters
selfobject
Returns
current number of repretitions for quantization.
void const* vl_gmm_get_posteriors ( VlGMM const *  self)
Parameters
selfobject
Returns
posterior probabilities of cluster memberships.
void const* vl_gmm_get_priors ( VlGMM const *  self)
Parameters
selfobject
Returns
priors of cluster gaussians.
int vl_gmm_get_verbosity ( VlGMM const *  self)
Parameters
selfobject
Returns
verbosity level.
void vl_gmm_init_with_kmeans ( VlGMM self,
void const *  data,
vl_size  numData,
VlKMeans kmeansInit 
)
Parameters
selfGMM object instance.
datadata points which should be clustered.
numDatanumber of data points.
kmeansInitKMeans object to use.
void vl_gmm_init_with_rand_data ( VlGMM self,
void const *  data,
vl_size  numData 
)
Parameters
selfGMM object instance.
datadata points which should be clustered.
numDatanumber of data points.
VlGMM* vl_gmm_new ( vl_type  dataType,
vl_size  dimension,
vl_size  numComponents 
)
Parameters
dataTypetype of data (VL_TYPE_FLOAT or VL_TYPE_DOUBLE)
dimensiondimension of the data.
numComponentsnumber of Gaussian mixture components.
Returns
new GMM object instance.
VlGMM* vl_gmm_new_copy ( VlGMM const *  self)
Parameters
selfobject.
Returns
new copy.

Most parameters, including the cluster priors, means, and covariances are copied. Data posteriors (available after initalization or EM) are not; nor is the KMeans object used for initialization, if any.

void vl_gmm_reset ( VlGMM self)
Parameters
selfobject.

The function reset the state of the GMM object. It deletes any stored posterior and other internal state variables.

void vl_gmm_set_covariance_lower_bound ( VlGMM self,
double  bound 
)
Parameters
selfobject.
boundbound.

While there is one lower bound per dimension, this function sets all of them to the specified scalar. Use vl_gmm_set_covariance_lower_bounds to set them individually.

void vl_gmm_set_covariance_lower_bounds ( VlGMM self,
double const *  bounds 
)
Parameters
selfobject.
boundsbounds.

There is one lower bound per dimension. Use vl_gmm_set_covariance_lower_bound to set all of them to a given scalar.

void vl_gmm_set_covariances ( VlGMM self,
void const *  covariances 
)
Parameters
selfGMM object instance.
covariancesinitial values of covariance matrix diagonals.
void vl_gmm_set_initialization ( VlGMM self,
VlGMMInitialization  init 
)
Parameters
selfobject
initinitialization algorithm.
void vl_gmm_set_kmeans_init_object ( VlGMM self,
VlKMeans kmeans 
)
Parameters
selfobject
kmeansinitialization KMeans object.
void vl_gmm_set_max_num_iterations ( VlGMM self,
vl_size  maxNumIterations 
)
Parameters
selfVlGMM filter.
maxNumIterationsmaximum number of iterations.
void vl_gmm_set_means ( VlGMM self,
void const *  means 
)
Parameters
selfGMM object instance.
meansinitial values of means.
void vl_gmm_set_num_repetitions ( VlGMM self,
vl_size  numRepetitions 
)
Parameters
selfobject
numRepetitionsmaximum number of repetitions. The number of repetitions cannot be smaller than 1.
void vl_gmm_set_priors ( VlGMM self,
void const *  priors 
)
Parameters
selfGMM object instance.
priorsinitial values of the gaussian priors.
void vl_gmm_set_verbosity ( VlGMM self,
int  verbosity 
)
Parameters
selfobject
verbosityverbosity level.