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

📄 random_dd.m

📁 模式识别工具箱,希望对大家有用!
💻 M
字号:
%RANDOM_DD Random one-class classifier% %       W = random_dd(A,fracrej)% % This is the trivial one-class classifier, randomly assigning labels% and rejecting fracrej of the data objects. This procedure is just to% show the basic setup of a prtools classifier, and what is required% to define a one-class classifier.% 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 = empty_dd(a,fracrej)if nargin < 2 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:  % this trivial classifier cannot be trained. for each object we will  % output a random value between 0 and 1, indicating the probability  % that an object belongs to class 'target'  % if we would like to train something, we should do it here.  %and save all useful data:  W.threshold = fracrej;  % a threshold should always be defined  W = mapping(mfilename,W,str2mat('target','outlier'),0,c);else                               %testing  [nlab,lablist,m,k,c,p,featlist] = dataset(a);  [W,classlist,type,k,c] = mapping(fracrej);  % unpack  % output should consist of two numbers: the first indicating the  % probability that it belongs to the target, the second indicating  % the probability that it belongs to the outlier class. The latter  % is often the constant threshold:  newout = [rand(m,1) ones(m,1)*W.threshold];  W = dataset(newout,getlab(a),classlist,p,lablist);endreturn

⌨️ 快捷键说明

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