-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplotConvergence.m
More file actions
69 lines (64 loc) · 2.42 KB
/
plotConvergence.m
File metadata and controls
69 lines (64 loc) · 2.42 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%% Plot convergence curves for PAA
%
% Additional info: Figures 9 in article Probabilistic Archetypal
% Analysis by Seth and Eugster in Machine Learning Journal
%
% Copyright Sohan Seth sohan.seth@hiit.fi
verbose = false;
figure('papertype', 'a4', 'paperposition', [0 0 7 3.5])
datasetList = {'soccer', 'nips', 'guest survey', 'disaster'};
for dataset = datasetList
switch char(dataset)
case 'soccer'
filePath = '../../examples/archeplayers/result_soccer/result_arch_4_trial_';
MIN = 50;
XTICK = [MIN, 150, 400];
case 'nips'
filePath = '../../examples/NIPS/resultEM/result_arch_10_trial_';
MIN = 2;
XTICK = [MIN, 20, 50];
case 'guest survey'
filePath = '../../examples/GSAW97/result/result_arch_6_trial_';
MIN = 200;
XTICK = [MIN, 1500, 3000];
case 'disaster'
filePath = '../../examples/Disaster/results/resultDisaster_arch_10_trial_';
MIN = 1000;
XTICK = [MIN, 8000, 15000];
end
if 0 %exist('data_Covergence')
objList = cell(10, 1);
for countTrial = 1:10
load(sprintf('%s%d.mat', filePath, countTrial));
if strcmp(char(dataset), 'nips') | strcmp(char(dataset), 'soccer')
obj = -obj;
end
obj([false; abs((obj(1:end-1) - obj(2:end))./obj(1:end-1)) < 10^-6.5]) = [];
objList{countTrial}.x = MIN:length(obj);
objList{countTrial}.y = obj(MIN:end);
if verbose
fprintf('threshold reached? %d\n', ...
abs((obj(end) - obj(end-1)) / obj(end - 1)) < 10^-6)
end
end
save(sprintf('data_Convergence/%s', char(dataset)), 'objList')
else
load(sprintf('data_Convergence/%s', char(dataset)), 'objList')
end
subplot(2, 2, find(strcmp(dataset, datasetList))),
hold on
for countTrial = 1:10
plot(objList{countTrial}.x, objList{countTrial}.y, ...
'color', [1 1 1] * 0.4)
end
axis tight
set(gca, 'fontsize', 10, 'xtick', XTICK, ...
'xticklabel', num2str(XTICK'))%, 'yscale', 'log')
xlabel('Iteration'), ylabel('cost');
title(dataset)
box on, grid on
end
% print('-dpng','-r400','../../Paper-NIPS-ICML-arXiv-KDD-ML/convergence.png')
% saveas(gca, '../../Paper-NIPS-ICML-arXiv-KDD-ML/convergence.eps', 'epsc')
%%
close all