mlpack_gmm_train(1)
π mlpack_gmm_train β gaussian mixture model (gmm) training π
okay bestie, welcome to the mlpack_gmm_train page of the mlpack manual (that's the manual name, hi, love her). this is the little tool that teaches a Gaussian mixture model what your data looks like. she's giving β¨unsupervised eleganceβ¨ and honestly? obsessed.
πΈ SYNOPSIS πΈ
mlpack_gmm_train -g int -i unknown [-d bool] [-m unknown] [-k int] [-n int] [-P bool] [-N double] [-p double] [-r bool] [-S int] [-s int] [-T double] [-t int] [-V bool] [-M unknown] [-h -v]
π DESCRIPTION π
so basically, this program takes a parametric estimate of a Gaussian mixture model (GMM) using the EM algorithm to find the maximum likelihood estimate. she fits, she converges, she serves. the model may be saved and reused by other mlpack GMM tools β no cap, it's literally reusable. π
the input data you're training on has to be specified with the --input_file (-i) parameter, and the number of Gaussians in the model has to be specified with the --gaussians (-g) parameter. those two are non-negotiable, bestie. π
optionally, you can run many trials with different random initializations, and the result with highest log-likelihood on the training data will be taken. the number of trials is specified with the --trials (-t) parameter. by default, only one trial is run. one and done, lowkey minimal effort but valid.
the tolerance for convergence and maximum number of iterations of the EM algorithm are specified with the --tolerance (-T) and --max_iterations (-n) parameters, respectively. π¦
your GMM may be initialized for training with another model, specified with the --input_model_file (-m) parameter. otherwise, the model is initialized by running k-means on the data. the k-means clustering initialization can be controlled with the --kmeans_max_iterations (-k), --refined_start (-r), --samplings (-S), and --percentage (-p) parameters. if --refined_start (-r) is specified, then the Bradley-Fayyad refined start initialization will be used. this can often lead to better clustering results β it's giving glow-up. β¨
the diagonal_covariance flag will cause the learned covariances to be diagonal matrices. this significantly simplifies the model itself and causes training to be faster, but restricts the ability to fit more complex GMMs. fast and simple vs. complex and fancy, pick your main character energy. π
π if GMM training fails with an error indicating that a covariance matrix could not be inverted, make sure that the--no_force_positive (-P)parameter is not specified. alternately, adding a small amount of Gaussian noise (using the--noise (-N)parameter) to the entire dataset may help prevent Gaussians with zero variance in a particular dimension, which is usually the cause of non-invertible covariance matrices. bestie this is the fix, write it down. π
π the --no_force_positive (-P) parameter, if set, will avoid the checks after each iteration of the EM algorithm which ensure that the covariance matrices are positive definite. specifying the flag can cause faster runtime, but may also cause non-positive definite covariance matrices, which will cause the program to crash. so likeβ¦ speedrun but the reward is a segfault. your call bestie. π
as an example, to train a 6-Gaussian GMM on the data in data.csv with a maximum of 100 iterations of EM and 3 trials, saving the trained GMM to gmm.bin, the following command can be used:
$ mlpack_gmm_train --input_file data.csv --gaussians 6 --trials 3 --output_model_file gmm.bin
to re-train that GMM on another set of data data2.csv, the following command may be used:
$ mlpack_gmm_train --input_model_file gmm.bin --input_file data2.csv --gaussians 6 --output_model_file new_gmm.bin
π REQUIRED INPUT OPTIONS π
these are the ones you literally cannot skip, periodt.
--gaussians (-g)[int] β number of Gaussians in the GMM. yeah, like, how many bell curves are we stacking. ποΈ--input_file (-i)[unknown] β the training data on which the model will be fit. this is the moment. this is the data. feed her. π
β OPTIONAL INPUT OPTIONS β
the optional girlypops. mix and match, iykyk.
--diagonal_covariance (-d)[bool] β force the covariance of the Gaussians to be diagonal. this can accelerate training time significantly. β¨--help (-h)[bool] β default help info. she's just here to help a girl out. π«Ά--info[string] β print help on a specific option. default value''. π--input_model_file (-m)[unknown] β initial input GMM model to start training with. like, a head start, a little pre-game. π₯--kmeans_max_iterations (-k)[int] β maximum number of iterations for the k-means algorithm (used to initialize EM). default value1000. π«--max_iterations (-n)[int] β maximum number of iterations of EM algorithm (passing0will run until convergence). default value250. π--no_force_positive (-P)[bool] β do not force the covariance matrices to be positive definite. read the warning above, bestie, this one has lore. π--noise (-N)[double] β variance of zero-mean Gaussian noise to add to data. default value0. a lil sprinkle of chaos to keep things invertible. πΈ--percentage (-p)[double] β if using--refined_start, specify the percentage of the dataset used for each sampling (should be between0.0and1.0). default value0.02. π¦--refined_start (-r)[bool] β during the initialization, use refined initial positions for k-means clustering (Bradley and Fayyad, 1998). academic queen behavior. π--samplings (-S)[int] β if using--refined_start, specify the number of samplings used for initial points. default value100. π--seed (-s)[int] β random seed. if0,std::time(NULL)is used. default value0. deterministic girlies rise. π²--tolerance (-T)[double] β tolerance for convergence of EM. default value1e-10. so precise, so tiny, so iconic. π¬--trials (-t)[int] β number of trials to perform in training GMM. default value1. π―--verbose (-v)[bool] β display informational messages and the full list of parameters and timers at the end of execution. she's yapping but it's informative yapping. π£οΈ--version (-V)[bool] β display the version of mlpack. π
π¦ OPTIONAL OUTPUT OPTIONS π¦
--output_model_file (-M)[unknown] β output for trained GMM model. your baby, all grown up, saved to disk. ππ
π ADDITIONAL INFORMATION π
for further information, including relevant papers, citations, and theory, consult the documentation found at http://www.mlpack.org or included with your distribution of mlpack. go read, bestie, the theory is lowkey stunning. πβ¨
and that's the whole page, fr fr. this lil manual page shipped as part of mlpack-4.8.0, dated 22 June 2026 β mwah, she ate, no crumbs. π ππ
π¦ where this page comes from
- ubuntu stonking: mlpack-bin 4.8.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms