-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathresults_analyzer.m
More file actions
25 lines (25 loc) · 891 Bytes
/
Copy pathresults_analyzer.m
File metadata and controls
25 lines (25 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% Author: Claudio S. De Mutiis (claudiodemutiis@gmail.com)
% Date: October 2016
% This function runs the EM algorithm num_emruns times for every k in
% k_vec. At the end, it returns and makes two plots for the means and
% standard deviations for every k.
% --> [means, stds] = results_analyzer(num_emruns, k_vec,num_it)
function [means, stds] = results_analyzer(num_emruns, k_vec,num_it)
l = length(k_vec);
results = zeros(num_emruns,l);
for i = 1:num_emruns
[results(i,:),~,~,~] = start_em(k_vec,num_it,'n');
end
stds = std(results);
means = mean(results);
figure(1)
plot(k_vec, stds, 'b*');
title('EM ANALYSIS (standard deviations)');
xlabel('K')
ylabel('Standard Deviation of the log-likelihood')
figure(2)
plot(k_vec, means, 'b*');
title('EM ANALYSIS (means)');
xlabel('K')
ylabel('Mean of the log-likelihood')
end