gmm.c File Reference
Gaussian Mixture Models - Implementation. More...
#include "gmm.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mathop_avx.h"
#include "shuffle-def.h"
Functions | |
VlGMM * | vl_gmm_new (vl_type dataType, vl_size dimension, vl_size numComponents) |
Create a new GMM object. More... | |
void | vl_gmm_reset (VlGMM *self) |
Reset state. More... | |
void | vl_gmm_delete (VlGMM *self) |
Deletes a GMM object. More... | |
vl_type | vl_gmm_get_data_type (VlGMM const *self) |
Get data type. More... | |
vl_size | vl_gmm_get_num_clusters (VlGMM const *self) |
Get the number of clusters. More... | |
vl_size | vl_gmm_get_num_data (VlGMM const *self) |
Get the number of data points. 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... | |
void | vl_gmm_set_verbosity (VlGMM *self, int verbosity) |
Set verbosity level. More... | |
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_size | vl_gmm_get_max_num_iterations (VlGMM const *self) |
Get maximum number of iterations. More... | |
void | vl_gmm_set_max_num_iterations (VlGMM *self, vl_size maxNumIterations) |
Set maximum number of iterations. More... | |
void | vl_gmm_set_num_repetitions (VlGMM *self, vl_size numRepetitions) |
Set maximum number of repetitions. More... | |
vl_size | vl_gmm_get_dimension (VlGMM const *self) |
Get data dimension. More... | |
VlGMMInitialization | vl_gmm_get_initialization (VlGMM const *self) |
Get initialization algorithm. More... | |
void | vl_gmm_set_initialization (VlGMM *self, VlGMMInitialization init) |
Set initialization algorithm. More... | |
VlKMeans * | vl_gmm_get_kmeans_init_object (VlGMM const *self) |
Get KMeans initialization object. More... | |
void | vl_gmm_set_kmeans_init_object (VlGMM *self, VlKMeans *kmeans) |
Set 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... | |
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... | |
VlGMM * | vl_gmm_new_copy (VlGMM const *self) |
Create a new GMM object by copy. More... | |
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_cluster (VlGMM *self, void const *data, vl_size numData) |
Run GMM clustering - includes initialization and EM. More... | |
double | vl_gmm_em (VlGMM *self, void const *data, vl_size numData) |
Invoke the EM algorithm. More... | |
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... | |
Get parameters | |
vl_size | vl_gmm_get_num_repetitions (VlGMM const *self) |
Get maximum number of repetitions. More... | |
Detailed Description
Function Documentation
◆ vl_gmm_cluster()
- Parameters
-
self GMM object instance. data data points which should be clustered. numData number of data points.
◆ vl_gmm_delete()
void vl_gmm_delete | ( | VlGMM * | self | ) |
- Parameters
-
self GMM object instance.
The function deletes the GMM object instance created by vl_gmm_new.
◆ vl_gmm_em()
- Parameters
-
self GMM object instance. data data points which should be clustered. numData number of data points.
◆ vl_gmm_get_covariance_lower_bounds()
double const* vl_gmm_get_covariance_lower_bounds | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- lower bound on covariances.
◆ vl_gmm_get_covariances()
void const* vl_gmm_get_covariances | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- diagonals of cluster covariance matrices.
◆ vl_gmm_get_data_type()
vl_type vl_gmm_get_data_type | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- data type.
◆ vl_gmm_get_dimension()
◆ vl_gmm_get_initialization()
VlGMMInitialization vl_gmm_get_initialization | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- initialization algorithm.
◆ vl_gmm_get_kmeans_init_object()
- Parameters
-
self object
- Returns
- kmeans initialization object.
◆ vl_gmm_get_loglikelihood()
double vl_gmm_get_loglikelihood | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- loglikelihood.
◆ vl_gmm_get_max_num_iterations()
- Parameters
-
self object
- Returns
- maximum number of iterations.
◆ vl_gmm_get_means()
void const* vl_gmm_get_means | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- cluster means.
◆ vl_gmm_get_num_clusters()
- Parameters
-
self object
- Returns
- number of clusters.
◆ vl_gmm_get_num_data()
- Parameters
-
self object
- Returns
- number of data points.
◆ vl_gmm_get_num_repetitions()
- Parameters
-
self object
- Returns
- current number of repretitions for quantization.
◆ vl_gmm_get_posteriors()
void const* vl_gmm_get_posteriors | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- posterior probabilities of cluster memberships.
◆ vl_gmm_get_priors()
void const* vl_gmm_get_priors | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- priors of cluster gaussians.
◆ vl_gmm_get_verbosity()
int vl_gmm_get_verbosity | ( | VlGMM const * | self | ) |
- Parameters
-
self object
- Returns
- verbosity level.
◆ vl_gmm_init_with_kmeans()
void vl_gmm_init_with_kmeans | ( | VlGMM * | self, |
void const * | data, | ||
vl_size | numData, | ||
VlKMeans * | kmeansInit | ||
) |
- Parameters
-
self GMM object instance. data data points which should be clustered. numData number of data points. kmeansInit KMeans object to use.
◆ vl_gmm_init_with_rand_data()
- Parameters
-
self GMM object instance. data data points which should be clustered. numData number of data points.
◆ vl_gmm_new()
- Parameters
-
dataType type of data (VL_TYPE_FLOAT or VL_TYPE_DOUBLE) dimension dimension of the data. numComponents number of Gaussian mixture components.
- Returns
- new GMM object instance.
◆ vl_gmm_new_copy()
- Parameters
-
self object.
- 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.
◆ vl_gmm_reset()
void vl_gmm_reset | ( | VlGMM * | self | ) |
- Parameters
-
self object.
The function reset the state of the GMM object. It deletes any stored posterior and other internal state variables.
◆ vl_gmm_set_covariance_lower_bound()
void vl_gmm_set_covariance_lower_bound | ( | VlGMM * | self, |
double | bound | ||
) |
- Parameters
-
self object. bound bound.
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.
◆ vl_gmm_set_covariance_lower_bounds()
void vl_gmm_set_covariance_lower_bounds | ( | VlGMM * | self, |
double const * | bounds | ||
) |
- Parameters
-
self object. bounds bounds.
There is one lower bound per dimension. Use vl_gmm_set_covariance_lower_bound to set all of them to a given scalar.
◆ vl_gmm_set_covariances()
void vl_gmm_set_covariances | ( | VlGMM * | self, |
void const * | covariances | ||
) |
- Parameters
-
self GMM object instance. covariances initial values of covariance matrix diagonals.
◆ vl_gmm_set_initialization()
void vl_gmm_set_initialization | ( | VlGMM * | self, |
VlGMMInitialization | init | ||
) |
- Parameters
-
self object init initialization algorithm.
◆ vl_gmm_set_kmeans_init_object()
- Parameters
-
self object kmeans initialization KMeans object.
◆ vl_gmm_set_max_num_iterations()
- Parameters
-
self VlGMM filter. maxNumIterations maximum number of iterations.
◆ vl_gmm_set_means()
void vl_gmm_set_means | ( | VlGMM * | self, |
void const * | means | ||
) |
- Parameters
-
self GMM object instance. means initial values of means.
◆ vl_gmm_set_num_repetitions()
- Parameters
-
self object numRepetitions maximum number of repetitions. The number of repetitions cannot be smaller than 1.
◆ vl_gmm_set_priors()
void vl_gmm_set_priors | ( | VlGMM * | self, |
void const * | priors | ||
) |
- Parameters
-
self GMM object instance. priors initial values of the gaussian priors.
◆ vl_gmm_set_verbosity()
void vl_gmm_set_verbosity | ( | VlGMM * | self, |
int | verbosity | ||
) |
- Parameters
-
self object verbosity verbosity level.