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

📄 gauss_dd.m

📁 数据挖掘的工具箱,最新版的,希望对做这方面研究的人有用
💻 M
字号:
%GAUSS_DD Gaussian data description.% %       W = gauss_dd(A,fracrej,r)% % Fit a Gaussian density on dataset A. If requested, the r can be% given to add some regularization to the estimated covariance matrix:% sig_new = (1-r)*sig + r*eye(dim). Default r = 0.01!!! (might be% dangerous!)%% This version acutally computes just the Mahalanobis distance to the% mean. This should avoid underflows at the computation of a real Gaussian% density (especially problematic in high dimensional spaces).%% See also datasets, mappings, dd_roc% Copyright: D.M.J. Tax, 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 Netherlands  function W = gauss_dd(a,fracrej,r)if nargin < 3, r = 0.01; endif nargin < 2 | isempty(fracrej), fracrej = 0.05; endif nargin < 1 | isempty(a) 	W = mapping(mfilename,{fracrej});	W = setname(W,'Gaussian one-class classifier');	returnendif ~ismapping(fracrej)           %training	a = target_class(a);     % only use the target class	k = size(a,2);	% Train it:	[mu,sig] = meancov(+a);	sig = (1-r)*sig + r*eye(k);	% Obtain the threshold:	d = mahaldist(a,mu,sig,-1);	thr = dd_threshold(d,1-fracrej);	%and save all useful data:	W.m = +mu;	W.s = sig;	W.threshold = thr;	W = mapping(mfilename,'trained',W,str2mat('target','outlier'),k,2);	W = setname(W,'Gaussian one-class classifier');else                               %testing	% Extract the data:	W = getdata(fracrej);	m = size(a,1);	% Compute the Mahalanobis distance (to avoid problems in the non-essential	% normalization factor):	newout = -[mahaldist(+a,W.m,W.s,-1) repmat(W.threshold,m,1)];	W = setdat(a,newout,fracrej);endreturn

⌨️ 快捷键说明

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