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

📄 quadrc.m

📁 模式识别 MATLAB 的工具箱,比较实用,包括SVM,ICA,PCA,NN等等模式识别算法.
💻 M
字号:
%QUADRC Quadratic Discriminant Classifier% % 	W = quadrc(A,r,s)% % Computation of the quadratic classifier between the classes of the % dataset A assuming normal densities. r and s (0 <= r,s <=1) are % regularization parameters used for finding the  covariance matrix % by % % 	G = (1-r-s)*G + r*diag(diag(G)) +% 				s*mean(diag(G))*eye(size(G,1))% % Default: r = 0, s= 0.%% This routine differs from qdc by that it is not based on densities,% but just computes a quadratic classifier based on the class covariances.% The multi-class problem is solved by a multiple two-class quadratic% discrimiant.% % See also datasets, mappings, nmc, nmsc, ldc, udc, qdc% 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 W = quadrc(a,r,s)if nargin < 3, s = 0; endif nargin < 2, r = 0; endif nargin < 1 | isempty(a)	W = mapping('quadrc',{r,s});	returnend[nlab,lablist,m,k,c,p] = dataset(a);if min(sum(expandd(nlab,c),1)) < 2	error('Classes should contain more than one vector')endif c == 2	pa = p(1); pb = p(2);	JA = find(nlab==1); JB = find(nlab==2);	ma = mean(a(JA,:)); mb = mean(a(JB,:));	GA = covm(a(JA,:));  GB = covm(a(JB,:));	GA = inv((1-r-s) * GA + r * diag(diag(GA)) + s*mean(diag(GA))*eye(size(GA,1)));	GB = inv((1-r-s) * GB + r * diag(diag(GB)) + s*mean(diag(GB))*eye(size(GB,1)));	w2 = GB - GA;	w1 = 2*ma*GA-2*mb*GB;	w0 = (mb*GB*mb'-ma*GA*ma') + 2*log(pa/pb) + log(det(GA)/det(GB));   W = mapping('quadratic',{w0,w1',w2},lablist,k,1);   W = cnormc(W,a);else	W = mclassc(a,mapping('quadrc',{r,s}));endreturn

⌨️ 快捷键说明

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