% Testing the EM algorithm

% it is suggested you use the NETLAB package
addpath('Netlabpath');

data = load('d_em.txt');
[N,dim] = size(data);

plot3(data(:,1),data(:,2),data(:,3),'kx');

% You should use the Gaussian mixture model to decompose the data
%
% The functions are: gmm(...); foptions; gmminit(...); gmmem(...);

% once the parameters computed, you can check the activations of each
% mixture component using
%
% a = gmmactiv(...)
% that returns the responsabilities of each component in generating the
% data.


CC = mixture.centres;
for ii=1:4;
  plot3(CC(ii,1),CC(ii,2),CC(ii,3),'g+','markersize',15,'linewidth',10);
end;

% also plot the covariance structure via the eigendecomposition.
% (exercise 1)
