% EM.m % EM algorithm for mixture of Gaussians % components % EM_init.m % initialization the probabilistic model parameters % Model = EM_init( m, x ) % input % m : mixture number % x : reference data % output % Model : model structure % % EM_dostep.m % do E_step and M_step and update model parameters % Model = EM_dostep( Model, x ) % input % Model : model structure % x : data to learn % output % Model : model structure updated % % EM_mixGaussPlot.m % 2 dimensional plot for mixture of Gaussians % EM_mixGaussPlot( Model, x ) % input % Model : Model to be illustrated % x : sample data to be illustrated %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Ndata と M の値を変えて試して見よ % 学習データ数 Ndata = 50; % ユニットの個数 M = 3; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load dataEM1 x=x(:,1:Ndata); Model = EM_init( M, x ); EM_mixGaussPlot(Model,x) hold off for epoch = 1:50 pause Model = EM_dostep( Model, x ); EM_mixGaussPlot(Model,x) title( ['epoch=' num2str(epoch)]) hold off end