polyc.m

来自「matlab 模式识别工具包 希望能对你们有用」· M 代码 · 共 46 行

M
46
字号
%POLYC Polynomial Classification% % 	W = polyc(A,classf,n,s)% % Adds polynomial features to the dataset A and runs the untrained % classifier classf. n is the degree of the polynome (default 1). If % s == 1 (default 0) all second order combination terms are added as % well.% % See also mappings, datasets% 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 = polyc(a,classf,n,s)if nargin < 4, s = 0; endif nargin < 3, n = 1; endif nargin < 2, classf = 'fisherc'; endif nargin < 1 | isempty(a)	W = mapping('polyc',{classf,n,s});	returnend[nlab,lablist,m,k,c] = dataset(a);P = eye(k);for j = 2:n	P = [P; j*eye(k)];endif s & (k > 1)	Q = zeros(k*(k-1)/2,k);	n = 0;	for j1 = 1:k		for j2 = j1+1:k			n = n+1;			Q(n,j2) = Q(n,j2)+1;			Q(n,j1) = Q(n,j1)+1;		end	end	P = [P;Q];endv = cmapm(k,P);w = a*v*classf;W = v*w;return

⌨️ 快捷键说明

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