May 2020
Intermediate to advanced
530 pages
17h 8m
English
The GMM algorithm assumes that clusters can be fit to some Gaussian (normal) distributions; it uses the EM approach for training. There is a CGMM class in the Shogun library that implements this algorithm, as illustrated in the following code snippet:
Some<CDenseFeatures<DataType>> features; int num_clusters = 2; ... auto gmm = some<CGMM>(num_clusters); gmm->set_features(features); gmm->train_em();
Notice that the constructor of the CGMM class takes the desired number of clusters as an argument. After CGMM object initialization, we pass training features and use the EM method for training. The following piece of code shows these steps and also plots the results of clustering:
Clusters clusters; auto feature_matrix = features->get_feature_matrix(); ...
Read now
Unlock full access