source: prextra/testmc.m @ 110

Last change on this file since 110 was 5, checked in by bduin, 14 years ago
File size: 851 bytes
Line 
1%TESTMC More classifier tests
2%
3% E = TESTMC(A,W,TYPE)
4% E = TESTMC(A*W,TYPE)
5
6function e = testmc(a,w,varargin)
7
8prtrace(mfilename);
9
10if nargin < 1
11        error('Insufficient parameters given')
12end
13
14isdataset(a);
15
16if nargin == 1
17        d = a;
18        type = {'conf'};
19elseif ismapping(w)
20        d = a*w;
21        if nargin < 3
22                type = {'conf'};
23        else
24                type = varargin;
25        end
26elseif isstr(w)
27        d = a;
28        type = {w};
29elseif iscell(w)
30        d = a;
31        type = w;
32else
33        error('Illegal call')
34end
35
36d = d*maxc;
37I = matchlablist(getlablist(d),getfeatlab(d));
38J = I(d.nlab); % J(i) is the column of the true label of object i
39e = zeros(1,length(type));
40m = size(d,1);
41for j=1:length(type)
42        switch(type{j})
43                case 'conf'
44            d = +normm(d,1);
45                        dd = d([1:m]'+(J-1)*m);
46                        e(j) = 1-mean(dd);
47                otherwise
48                        error('Illegal type')
49        end
50end
51                       
52                       
Note: See TracBrowser for help on using the repository browser.