parzen_dd.m

来自「模式识别工具箱,希望对大家有用!」· M 代码 · 共 64 行

M
64
字号
%PARZEN_DD Parzen data description.% %       W = parzen_dd(A,fracrej)% % Fit a Parzen density on dataset A. The threshold is put such that% fracrej of the target objects is rejected.% %       W = parzen_dd(A,fracrej,h)% % If the width parameter is known, it can be given as third parameter.% % 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,h] = parzen_dd(a,fracrej,h)if nargin < 2 | isempty(fracrej), fracrej = 0.05; endif nargin < 1 | isempty(a)   W = mapping(mfilename,{fracrej});  returnendif isa(fracrej,'double')           %training  if isa(a,'mapping')    error('I need a dataset to train');  end  a = target_class(a);     % make sure a is an OC dataset  [nlab,lablist,m,k,c] = dataset(a);  % train it:  if nargin<3    h = parzenml(a);  end  w = parzenc(a,h);  % obtain the threshold:  d = +p_map(a,w);  thr = threshold(d,fracrej);  %and save all useful data:  W.w = w;  W.threshold = thr;  W = mapping(mfilename,W,str2mat('target','outlier'),k,c);  out = h;else                               %testing  [W,classlist,type,k,c] = mapping(fracrej);  % unpack  [nlab,lablist,m,k,c,p] = dataset(a);  %compute:  out = +p_map(a,W.w);  newout = [out, ones(m,1)*W.threshold];  W = dataset(newout,getlab(a),classlist,p,lablist);endreturn

⌨️ 快捷键说明

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