
% generate some data
alpha = 0.4;
X = [ 
    alpha*randn(100,1)-1 alpha*randn(100,1)+1;
    alpha*randn(100,1)+0 alpha*randn(100,1)+1;
    alpha*randn(100,1)+1 alpha*randn(100,1)+1;
    alpha*randn(100,1)-1 alpha*randn(100,1)+0;
    alpha*randn(100,1)+0 alpha*randn(100,1)+0;
    alpha*randn(100,1)+1 alpha*randn(100,1)+0;
    alpha*randn(100,1)-1 alpha*randn(100,1)-1;
    alpha*randn(100,1)+0 alpha*randn(100,1)-1;
    alpha*randn(100,1)+1 alpha*randn(100,1)-1;
    ];
X = [X ones(900,1)];

%Yvec = [ones(100,1) zeros(100,1);
%        ones(100,1) zeros(100,1);
%        zeros(100,1) ones(100,1)
%        zeros(100,1) ones(100,1)];

a = [ones(100,1) zeros(100,1) zeros(100,1)];
b = [zeros(100,1) ones(100,1) zeros(100,1)];
c = [zeros(100,1) zeros(100,1) ones(100,1)];
Yvec = [ a;b;c;b;c;a;c;a;b ];

[v,Y] = max(Yvec,[],2);

kolor = ['r' 'b' 'k' 'g'];

figure(1); clf;
hold on;
for i = 1:4
  ind = find(Y == i);
  plot(X(ind,1),X(ind,2),[kolor(i) '.']);
end;
axis([-2 2 -2 2]);

%  create an HME with two experts
hme1 = hmeFit(hmeCreate(1,4,3,3),X',Yvec');


