📄 dd_example.m
字号:
% DD_EXAMPLE%% Example of the creation of a One-Class problem, and the solutions% obtained by the Nearest Neighbor Data Description and the Support% Vector Data Description.% Copyright: D. Tax, R.P.W. Duin, davidt@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlands% generate normal classification problem: train data:fracrej = 0.1;a = gendatb(50);% make the second class the target class and change the labels:a = oc_set(a,'B');% only use target class:a = target_class(a);% generate test data:b = oc_set(gendatb(100),'B');% first show a 2D plot:lw = 3; %linewidthms = 10; %markersizefs = 16; %fontsizefigure(1); clf; hold on; H = [0;0];h=scatterd(a);V = axis; axis(1.5*V);set(h,'markersize',ms,'linewidth',lw);% train the individual data descriptions and plot themw1 = nndd(a,fracrej);h = plotd(w1,'g-');set(h,'linewidth',lw);H(1) = h(1);w2 = svdd(a,fracrej);h = plotd(w2,'r--');set(h,'linewidth',lw);H(2) = h(1);%legend(H,'NN dd','SVDD');axis equal;axis image;fontsize(fs);% second show the ROC curves:figure(2); clf;hold on; H=[0;0];% train the Nearest Neighbor method:w = nndd;e = dd_roc(w,a,b,0.01:0.01:0.5);e1 = e;h = plot2(e','g-');H(1) = h(1);err_nn = dd_auc(e)% train SVDD:w = svdd;e = dd_roc(w,a,b);h = plot2(e','r--');H(2) = h(1);err_svdd = dd_auc(e)xlabel('Target objects rejected');ylabel('Outlier objects accepted');title('ROC curves');fontsize(fs);%legend(H,'NN dd','SVDD');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -