Code covered by the BSD License  

Highlights from
Variational Bayesian Inference for Gaussian Mixture Model

image thumbnail

Variational Bayesian Inference for Gaussian Mixture Model

by

 

Variational Bayes method (mean field) for GMM can auto determine the number of components

logsumexp(x, dim)
function s = logsumexp(x, dim)
% Compute log(sum(exp(x),dim)) while avoiding numerical underflow.
%   By default dim = 1 (columns).
% Written by Michael Chen (sth4nth@gmail.com).
if nargin == 1, 
    % Determine which dimension sum will use
    dim = find(size(x)~=1,1);
    if isempty(dim), dim = 1; end
end

% subtract the largest in each column
y = max(x,[],dim);
x = bsxfun(@minus,x,y);
s = y + log(sum(exp(x),dim));
i = find(~isfinite(y));
if ~isempty(i)
    s(i) = y(i);
end

Contact us