/
check_parameters.m
121 lines (97 loc) · 3.76 KB
/
check_parameters.m
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
function results = check_parameters(method,trial,fold)
fprintf(1,'\n\n');
fprintf(1,'**************** Checking parameters.\n');
path = ['results' num2str(trial)];
path1 = sprintf('%s/*%s-*.mat',path, num2str(fold));
d = dir(path1);
fprintf(1,'Analysing: %s and remain.\n',[path '/' d(1).name]);
nneurons = [];
nlayers = [];
h = [];
s = [];
gamma = [];
C = [];
for i = 1:size(d,1) % number of runs
%fprintf(1,'Analysing: %s\n',[path '/' d(i).name]);
data = load([path '/' d(i).name]);
data = data.best_options;
nn = zeros(1,size(data,2));
for j = 1:size(data,2) % for each wr
switch ( method )
case {'SOM_threshold','SOM_weights'}
nn(j) = prod(data{j}.SOMconfig);
case {'rejoNN'}
nn(j) = data{j}.nneurons;
nl(j) = data{j}.nlayers;
h_(j) = data{j}.h;
s_(j) = data{j}.s;
case {'NN_weights','NN_threshold'}
nn(j) = data{j}.nneurons;
nl(j) = data{j}.nlayers;
case {'rejoSVM','rejoSVM_plus'}
gamma_(j) = data{j}.gamma;
C_(j) = data{j}.C;
h_(j) = data{j}.h;
s_(j) = data{j}.s;
case {'frankhall', 'frankhall_threshold'}
gamma_(j) = data{j}.gamma;
C_(j) = data{j}.C;
case 'fumera'
C_(j) = data{j}.C;
end
end
switch( method )
case {'SOM_threshold','SOM_weights'}
nneurons = [nneurons;nn];
case {'rejoNN'}
nneurons = [nneurons;nn];
nlayers = [nlayers; nl];
h = [h; h_];
s = [s; s_];
case {'NN_weights','NN_threshold'}
nneurons = [nneurons;nn];
nlayers = [nlayers; nl];
case {'rejoSVM','rejoSVM_plus'}
h = [h; h_];
s = [s; s_];
gamma = [gamma; gamma_];
C = [C; C_];
case {'frankhall','frankhall_threshold'}
gamma = [gamma; gamma_];
C = [C; C_];
case 'fumera'
C = [C; C_];
end
end
C = log(C)./log(2);
gamma = log(gamma)./log(2);
switch( method )
case {'SOM_threshold','SOM_weights'}
neurons = [ mean(nneurons,1); std(nneurons,0,1)] ;
fprintf(1,'neurons\t|\tMean: %d, std: %d\n',neurons(1),neurons(2));
case {'rejoNN'}
neurons = [ mean(nneurons,1); std(nneurons,0,1)]
layers = [ mean(nlayers,1); std(nlayers,0,1)]
h = [ mean(h,1); std(h,0,1)]
s = [ mean(s,1); std(s,0,1)]
results = struct('neurons',neurons,'layers',layers,'h',h,'s',s)
case {'NN_weights','NN_threshold'}
neurons = [ mean(nneurons,1); std(nneurons,0,1)]
layers = [ mean(nlayers,1); std(nlayers,0,1)]
results = struct('neurons',neurons,'layers',layers)
case {'rejoSVM','rejoSVM_plus'}
gamma = [mean(gamma,1); std(gamma,0,1)]
C = [mean(C,1); std(C,0,1)]
h = [ mean(h,1); std(h,0,1)]
s = [ mean(s,1); std(s,0,1)]
results = struct('h',h,'s',s,'C',C,'gamma',gamma)
case {'frankhall', 'frankhall_threshold'}
gamma = [mean(gamma,1); std(gamma,0,1)]
C = [mean(C,1); std(C,0,1)]
results = struct('C',C,'gamma',gamma)
case 'fumera'
C = [mean(C,1); std(C,0,1)]
results = struct('C',C)
end
fprintf(1,'\n\n');
return