📄 gmm.m
字号:
% [alpha, mu, sigma, ll ] = gmm(data, k, nres, sig, prevsing, maxstep, prec)
%
% INPUT:
% data : n by d data points (n points of dimensionality d).
% k : number of desired clusters.
% nres : number of random restarts.
% sig : d*d matrix of 0's and 1's used to cancel unwanted elements
% in sigma matrices (for forced decoupling).
% prevsing : d*1 vector of minimal diagonal values allowed in sigmas.
% maxstep : maximum number of allowed iteration in a single run.
% 100 is fine (mostly converges in 10-30, depending on prec)
% prec : required precision. 1e-3 is typically fine, after that it
% slows down at no extra accuracy gain. Corresponds roughly to
% number of significant digits.
%
% OUTPUT:
% alpha : weights of components (k by 1).
% mu : mean for each component (k by d).
% sigma : covariance matrix for each comp. (d by d by k).
% ll : best log-likelihood.
%
% NOTES:
% This is a .mex file and is much faster than the counterpart .m file.
% On some simple problems it was ~4 times faster than the (efficient)
% .m file. The program has hard-coded k-means and doesn't rely on any
% outside functions. If convergence is not established in maxstep, it
% returns the last available value. However, if k-means breaks its
% maximum number of iterations, it will produce an error (this will
% never, ever happen, but just in case...).
%
% by Igor Cadez 01/23/99
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -