⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edicon.m

📁 模式识别工具箱,本人毕业论文时用到的,希望对大家有用!
💻 M
字号:
%EDICON Edit and condense training set into support set% % 	J = edicon(D)% % Condensing: If D is the distance dataset then the indices J refer % to a minimized set that classifies the original set similarly % (leave-one-out for the training / support set) by the 1-NN rule.% % 	J = edicon(D,k,n)% % Before the above condensing the set is edited first by deleting % all objects that don't have n neighbours of their own class within % their k nearest neighbors.%% D can be computed from a dataset A by A*proxm(A).% % See also datasets, knnc, proxm% 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 = edicon(D,num1,num2)[nlab,lablist,m,k,c,p] = dataset(D);if m ~= k, error('Distance matrix should be square'); endexact = 0;if nargin > 1	if num1 == 0, exact = 1; endendif ~exact	D = D + diag(inf*ones(1,m));end				% find all nearest neigbors[E,K] = sort(D);R = zeros(1,m);R(K(1,:)) = ones(1,m);				% edittingif nargin > 2 & ~exact	if nargin == 3		num2 = 1;	end	L = reshape(nlab(K),m,m) == nlab(:,ones(1,m))';	if num1 == 1		J = L(1,:);	else				% find objects that have at least num2 neigbours				% of their class within the k nearest ones.		J = sum(L(1:num1,:)) >= num2;	endelse	J = ones(1,m);endn = inf;				% start condensing by anding these setsJ = find(R&J);JJ = find(~R);for j = JJ	K(find(K == j)) = []; 	K = reshape(K,length(K)/m,m);endwhile length(J) < n	n = length(J);	JJ = J(randperm(n));				% delete all objects where the next 				% neighbor has the same label	for j = JJ		N = find(K(1,:) == j);		nn = N(find(nlab(K(1,N)) ~= nlab(K(2,N))));		if isempty(nn)			J(find(J==j)) = [];			I = find(K == j);			K(I) = [];			K = reshape(K,length(K)/m,m);		end	endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -