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

📄 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.1!!!!! (might be% dangerous!)% % See also datasets, mappings, dd_roc% Copyright: D. 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,out] = gauss_dd(a,fracrej,r)if nargin < 3, r = 0.1; endif nargin < 2 | isempty(fracrej), fracrej = 0.05; endif nargin < 1 | isempty(a)   W = mapping(mfilename,{fracrej});  returnendif isa(fracrej,'double')           %training  if ~isa(a,'dataset')              %train on training set    error('I need a dataset to train');  end  a = target_class(a);     % only use the target class  [nlab,lablist,m,k,c,prob,featlist] = dataset(a);  % train it:  [mu,sig] = meancov(a);  sig = (1-r)*sig + r*eye(k);  % obtain the threshold:  p = gausspdf(a,+mu,sig);  thr = threshold(p,fracrej);  %and save all useful data:  W.m = +mu;  W.s = sig;  W.threshold = thr;%  W = {+mu,sig,thr,mean(d)};  W = mapping(mfilename,W,str2mat('target','outlier'),k,c);else                               %testing  [nlab,lablist,m,k,c,p,featlist] = dataset(a);  [W,classlist,type,k,c] = mapping(fracrej);  % unpack  %compute, target class > 0:  newout = [gausspdf(a,W.m,W.s) ones(m,1)*W.threshold];  W = dataset(newout,getlab(a),classlist,p,lablist);endreturn

⌨️ 快捷键说明

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