Rev | Line | |
---|
[5] | 1 | %TESTMC More classifier tests
|
---|
| 2 | %
|
---|
| 3 | % E = TESTMC(A,W,TYPE)
|
---|
| 4 | % E = TESTMC(A*W,TYPE)
|
---|
| 5 |
|
---|
| 6 | function e = testmc(a,w,varargin)
|
---|
| 7 |
|
---|
| 8 | prtrace(mfilename);
|
---|
| 9 |
|
---|
| 10 | if nargin < 1
|
---|
| 11 | error('Insufficient parameters given')
|
---|
| 12 | end
|
---|
| 13 |
|
---|
| 14 | isdataset(a);
|
---|
| 15 |
|
---|
| 16 | if nargin == 1
|
---|
| 17 | d = a;
|
---|
| 18 | type = {'conf'};
|
---|
| 19 | elseif ismapping(w)
|
---|
| 20 | d = a*w;
|
---|
| 21 | if nargin < 3
|
---|
| 22 | type = {'conf'};
|
---|
| 23 | else
|
---|
| 24 | type = varargin;
|
---|
| 25 | end
|
---|
| 26 | elseif isstr(w)
|
---|
| 27 | d = a;
|
---|
| 28 | type = {w};
|
---|
| 29 | elseif iscell(w)
|
---|
| 30 | d = a;
|
---|
| 31 | type = w;
|
---|
| 32 | else
|
---|
| 33 | error('Illegal call')
|
---|
| 34 | end
|
---|
| 35 |
|
---|
| 36 | d = d*maxc;
|
---|
| 37 | I = matchlablist(getlablist(d),getfeatlab(d));
|
---|
| 38 | J = I(d.nlab); % J(i) is the column of the true label of object i
|
---|
| 39 | e = zeros(1,length(type));
|
---|
| 40 | m = size(d,1);
|
---|
| 41 | for 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
|
---|
| 50 | end
|
---|
| 51 |
|
---|
| 52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.