/code_oth/disperror.m
http://research-code-base-animesh.googlecode.com/ · MATLAB · 91 lines · 53 code · 9 blank · 29 comment · 15 complexity · 4294977ae0df0303b5a1c03fe20a2bb6 MD5 · raw file
- %DISPERROR Display error matrix with information on classifiers and datasets
- %
- % DISPERROR(DATA,CLASSF,ERROR,STD,FID)
- %
- % INPUT
- % DATA Cell array of M datasets or dataset names (strings)
- % CLASSF Cell array of N mappings or mapping names (strings)
- % ERROR M*N matrix of (average) error estimates
- % STD M*N matrix of standard devations on ERROR (optional)
- % FID File in which results are written (default: 1)
- % OUTPUT
- %
- % DESCRIPTION
- % Displays the matrix ERROR matrix with error estimates for N
- % classifiers related to M datasets. This routine is called by TESTC
- % and CROSVALL to display results.
- %
- % EXAMPLE
- % testsets = {gendath gendatb gendatd(100,5)}
- % trainsets = {gendath gendatb gendatd(100,5)}
- % classifiers = {nmc fisherc qdc svc}
- % testc(testsets,map(trainsets,classifiers))
- %
- % SEE ALSO
- % MAPPINGS, DATASETS, TESTC, CROSSVAL
- % $Id: disperror.m,v 1.7 2004/10/04 15:43:10 duin Exp $
- function disperror (data,classf,err,stdev,fid)
-
- if nargin < 5, fid = 1; end
- % Check arguments.
- if (nargin > 3) & (any(size(err) ~= size(stdev)))
- error('size of matrix with standard deviations should match matrix with errors')
- end
- if (~iscell(classf)) | (~isstr(classf{1}) & ~ismapping(classf{1}))
- error('cell array of mappings or mapping names expected')
- end
- if (~iscell(data)) | (~isstr(data{1}) & ~isdataset(data{1}))
- error('cell array of datasets or datasets names expected')
- end
- [m,n] = size(err);
- if (length(data) ~= m)
- error('size of dataset cell array should equal number of rows in error matrix');
- end
- if (length(classf) ~= n)
- error('size of classifier cell array should equal number of columns in error matrix');
- end
- % If datasets are supplied, extract their names.
- for j = 1:m
- if (isdataset(data{j}))
- data{j} = getname(data{j},20);
- end
- end
- % If classifiers are supplied, extract their names.
- for j = 1:n
- if (ismapping(classf{j}))
- classf{j} = getname(classf{j});
- end
- end
- if (n == 1)
- fprintf(fid,' %s \n\n',classf{1});
- else
- fprintf(fid,'\n');
- for i = 1:n
- fprintf(fid,'\n clsf_%i : %s',i,classf{i});
- end
- fprintf(fid,'\n\n ');
- for i = 1:n
- fprintf(fid,' clsf_%i',i);
- end
- fprintf(fid,'\n\n');
- end
- for j = 1:m
- fprintf(fid,' %s',data{j});
- fprintf(fid,' %7.3f',err(j,:));
- if (nargin > 3)
- fprintf(fid,'\n ');
- fprintf(fid,' %7.3f',stdev(j,:));
- fprintf(fid,'\n');
- end
- fprintf(fid,'\n');
- end
- fprintf(fid,'\n');
-
- return