1 |
|
---|
2 | function ee = comparch2(type,L,n,iter)
|
---|
3 |
|
---|
4 | if nargin < 4, iter = 25; end
|
---|
5 | if nargin < 3 | isempty(n), n = 50; end
|
---|
6 | if nargin < 2, L = []; end
|
---|
7 |
|
---|
8 | W = classfs;
|
---|
9 | if ~isempty(L), W = W(L); end
|
---|
10 |
|
---|
11 | rand('state',0);
|
---|
12 | ee.names = getname(W{1});
|
---|
13 | for j=2:length(W)
|
---|
14 | ee.names = char(ee.names,getname(W{j}));
|
---|
15 | end
|
---|
16 |
|
---|
17 | learnsizes = n;
|
---|
18 |
|
---|
19 | e = zeros(length(W),length(learnsizes),iter);
|
---|
20 | b = genarche(type,1000,0);
|
---|
21 | for j=1:iter
|
---|
22 | for m = 1:length(learnsizes)
|
---|
23 | a = genarche(type,learnsizes(m),j);
|
---|
24 | for i=1:length(W)
|
---|
25 | e(i,m,j) = b*(a*W{i})*testc;
|
---|
26 | disp([j,m,i])
|
---|
27 | end
|
---|
28 | end
|
---|
29 | end
|
---|
30 |
|
---|
31 | ee.error = e;
|
---|
32 | ee.iter = iter;
|
---|
33 | ee.learnsizes = learnsizes;
|
---|
34 |
|
---|
35 | disp(type)
|
---|
36 | disp(' ')
|
---|
37 | for m = 1:length(learnsizes)
|
---|
38 | em = mean(squeeze(e(:,m,:))');
|
---|
39 | es = std(squeeze(e(:,m,:))');
|
---|
40 | [eem,J] = sort(em);
|
---|
41 | for i=1:length(W)
|
---|
42 | fprintf(1,'%7.4f %8.5f %s \n',em(J(i)),es(J(i))/sqrt(iter),ee.names(J(i),:));
|
---|
43 | end
|
---|
44 | end
|
---|
45 |
|
---|
46 | if isempty(L) % full set, store result
|
---|
47 | save([type '_' num2str(iter) '_' num2str(learnsizes(1))],'ee');
|
---|
48 | end
|
---|
49 |
|
---|
50 | %figure;
|
---|
51 | %scatterd(genarche(type,200,0));
|
---|
52 | %axis equal
|
---|
53 | %fsave('scatter_plot',14,2,5,1.5);
|
---|
54 | %ee.error = mean(e,3);
|
---|
55 | %ee.xvalues = learnsizes;
|
---|
56 | %ee.std = std(e,[],3)/sqrt(iter);
|
---|
57 | %plotr(ee,[],[],[],'errorbar')
|
---|
58 | %save(['arch2_' getmapping_file(W{n})],'ee','iter');
|
---|
59 |
|
---|
60 |
|
---|