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

📄 parzen_map.m

📁 模式识别工具包
💻 M
字号:
%PARZEN_MAP Map a dataset on a Parzen densities based classifier% % 	F = parzen_map(A,W)% % Maps the dataset A by the Parzen density based classfier W. F*sigm % are the posterior probabilities. W should be trained by a % classifier like parzenc. This routine is called automatically to % solve A*W if W is trained by parzenc.% % The global PRMEMORY is read for the maximum size of the internally % declared matrix, default inf.% % See also mappings, datasets, parzenc, testp% 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 F = parzen_map(T,W)if nargin < 2, W = parzenc(T); end[a,classlist,type,k,c,v,h] = mapping(W);if ~strcmp(type,'parzen_map') 	error('Wrong type of classifier')end[nlab,lablist,m,k,c,p] = dataset(a);p = p(:)';h = h(:)';[mt,kt] = size(T);if kt ~= k, error('Wrong feature size'); endif length(h) == 1, h = h * ones(1,c); endif length(h) ~= c	error('Wrong number of smoothing parameters')endmaxa = max(max(abs(a)));a = a/maxa;T = T/maxa;h = h/maxa;if isfeatim(T)	F = datgauss(T,h);endalf=sqrt(2*pi)^k;[num,n] = prmem(mt,m);F = ones(mt,c);for j = 0:num-1	if j == num-1		nn = mt - num*n + n;	else		nn = n;	end	range = [j*n+1:j*n+nn];	D = +distm(a,T(range,:));	for i=1:c		I = find(nlab == i);		if length(I) > 0			F(range,i) = mean(exp(-D(I,:)*0.5./(h(i).^2)),1)';		end	endend%F = F.*repmat(p./(alf.*h.^k),mt,1);if max(h) ~= min(h)	% avoid this when possible (problems with large k)	F = F.*repmat(p./(h.^k),mt,1);else	F = F.*repmat(p,mt,1);endF = F + realmin;F = F ./ (sum(F')'*ones(1,c));F = invsig(F);[nlab,lablist,m,k,c,p] = dataset(T);F = dataset(F,getlab(T),classlist,p,lablist);return

⌨️ 快捷键说明

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