📄 feateval.m
字号:
%FEATEVAL Evaluation of feature set% % J = feateval(A,crit,T)% % Evaluation of features by the criterion crit, using objects in the % dataset A. The larger J, the better. Resulting J-values are% incomparable over the following methods:% % crit='maha-s': sum of estimated Mahalanobis distances.% crit='maha-m': minimum of estimated Mahalanobis distances.% crit='eucl-s': sum of squared Euclidean distances.% crit='eucl-m': minimum of squared Euclidean distances.% crit='NN' : 1-Nearest Neighbour leave-one-out% classification performance (default).% (performance = 1 - error). % % crit can also be any untrained classifier, e.g. ldc([],1e-6,1e-6). % The classification error is used for a performance estimate. If % supplied, the dataset T is used for obtaining an unbiased estimate % the performance of classifiers trained with the dataset A. If T is % not given, the apparent performance on A is used. % % See also datasets, featselo, featselb, featself, featselp, % featselm, featrank% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction J = feateval(a,crit,t)[nlaba,lablista,ma,k,c] = dataset(a);if nargin < 2 crit = 'NN';endif nargin < 3, t =[]; endif ~isempty(t) [nlabt,lablistt,mt,kt,c] = dataset(t); if kt ~= k error('Data sets most have equal numbers of features') endendif isstr(crit) if strcmp(crit,'maha-s') | strcmp(crit,'maha-m') % Mahalanobis distances if isempty(t) D = distmaha(a); else [U,G] = meancov(a); D = distmaha(t,U,G); D = meancov(D); end if strcmp(crit,'maha-m') D = D + realmax*eye(c); J = min(min(D)); else J = sum(sum(D))/2; end elseif strcmp(crit,'eucl-s') | strcmp(crit,'eucl-m') % Euclidean distances U = meancov(a); if isempty(t) D = distm(U); else D = distm(t,U); D = meancov(D); end if strcmp(crit,'eucl-m') D = D + realmax*eye(c); J = min(min(D)); else J = sum(sum(D))/2; end elseif strcmp(crit,'NN') % 1-NN performance if isempty(t) J = 1 - testk(a,1); else J = 1 - testk(a,1,t); end else error('Criterion undefined'); endelse if isempty(t) J = 1 - (a * crit * a * testd); else J = 1 - (a * crit * t * testd); endendreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -