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

📄 normalm.m

📁 模式识别 MATLAB 的工具箱,比较实用,包括SVM,ICA,PCA,NN等等模式识别算法.
💻 M
字号:
%NORMALM Estimate normal densities%%	W = NORMALM(A,TYPE)%%	D = B*W%% For each of the classes in the dataset A a normal distribution% is estimated. The result is stored as a K*C mapping in W, in which% K is the dimensionality of the input space and C is the number% of classes.%% TYPE can be used to set some assumptions on the covariance matrices.% It can be 'unequal' (default), 'equal' and 'uncorrelated'.%% The mapping W may be applied to a new K-dimensional dataset B,% resulting in a C-dimensional dataset D. The values in D are not% properly scaled.%% See also datasets, mappings, parzenm, qdc, normal_mapfunction w = normalm(a,w)if nargin < 2, w = 'unequal'; endif nargin < 1 | isempty(a)	w = mapping(mfilename,w);	returnendif ~isa(w,'mapping')	switch w	case 'unequal'		w = qdc(a);	case 'equal'		w = ldc(a);	case 'uncorrelated'		w = udc(a);	otherwise		error('Unknown option for type')	end	w = set(w,'m',mfilename);elseif isa(w,'mapping')	w = normal_map(a,w);else	error('Illegal call')endfunction F = normal_map(A,W)[w,classlist,type,k,c,v,par] = mapping(W);deg = ndims(w{2})-1;U = +w{1}; G = w{2}; p = w{3};[m,ka] = size(A);if ka ~= k, error('Wrong feature size'); endF = zeros(m,c);if deg == 1	H = G;	if rank(H) < size(H,1)		E = real(pinv(H));	else		E = real(inv(H));	endendCmax = -inf;for i=1:c	X = +A - ones(m,1)*U(i,:);	if deg == 2		H = G(:,:,i);		if rank(H) < size(H,1)			E = real(pinv(H));		else			E = real(inv(H));		end	end	C = log(p(i)) - 0.5*(sum(log(real(eig(H))+realmin)) + log(2*pi));	F(:,i) = (C - sum(X'.*(E*X'),1).*0.5)'; endF = exp(F) + realmin;[nlab,lablist,m,k,c,p,classlista,imheight] = dataset(A);if imheight > 0, imheight = 0; endF = dataset(F,getlab(A),classlist,p,lablist,imheight);return

⌨️ 快捷键说明

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