%This program perform the training of the 10 classes data

clear
load initial

import_gmm


gmm1=gmm(2,5,'diag');
gmm2=gmm(2,5,'diag');
gmm3=gmm(2,5,'diag');
gmm4=gmm(2,5,'diag');
gmm5=gmm(2,5,'diag');
gmm6=gmm(2,5,'diag');
gmm7=gmm(2,5,'diag');
gmm8=gmm(2,5,'diag');
gmm9=gmm(2,5,'diag');
gmm10=gmm(2,5,'diag');

options = foptions;
options(1)  = 1;		% Prints out error values.
options(5) = 1;
options(14) = 100;		% Number of maximum iterations.


%Initialize the gmm(s)
gmm1=gmminit(gmm1, import_class1, options);
gmm2=gmminit(gmm2, import_class2, options);
gmm3=gmminit(gmm3, import_class3, options);
gmm4=gmminit(gmm4, import_class4, options);
gmm5=gmminit(gmm5, import_class5, options);
gmm6=gmminit(gmm6, import_class6, options);
gmm7=gmminit(gmm7, import_class7, options);
gmm8=gmminit(gmm8, import_class8, options);
gmm9=gmminit(gmm9, import_class9, options);
gmm10=gmminit(gmm10, import_class10, options);


%Perform EM algorithm
gmm1=gmmem(gmm1, import_class1, options);
gmm2=gmmem(gmm2, import_class2, options);
gmm3=gmmem(gmm3, import_class3, options);
gmm4=gmmem(gmm4, import_class4, options);
gmm5=gmmem(gmm5, import_class5, options);
gmm6=gmmem(gmm6, import_class6, options);
gmm7=gmmem(gmm7, import_class7, options);
gmm8=gmmem(gmm8, import_class8, options);
gmm9=gmmem(gmm9, import_class9, options);
gmm10=gmmem(gmm10, import_class10, options);
