I found a really good code at GitHub for fitting a Gaussian Mixture Model (GMM) with Expectation Maximization (EM) for ROS. There are so many parameters that you can change. Some of the most important ones are:
// minimum number of gaussians
#define PARAM_NAME_GAUSSIAN_COUNT_MIN "gaussian_count_min"
#define PARAM_DEFAULT_GAUSSIAN_COUNT_MIN 1
// search will terminate when the gaussian count reaches this
#define PARAM_NAME_GAUSSIAN_COUNT_MAX "gaussian_count_max"
#define PARAM_DEFAULT_GAUSSIAN_COUNT_MAX 10
To find the optimal number of components, it uses Bayesian information criterion (BIC). There are other methods to find …