-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdd_ex2.m
More file actions
executable file
·55 lines (44 loc) · 1.15 KB
/
dd_ex2.m
File metadata and controls
executable file
·55 lines (44 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% DD_EX2
%
% Show the performance of a whole list of classifiers on a simple
% artificial one-class problem.
% Copyright: D.M.J. Tax, D.M.J.Tax@prtools.org
% Faculty EWI, Delft University of Technology
% P.O. Box 5031, 2600 GA Delft, The Netherlands
% Generate data:
nrx = 50;
X = gendatb([nrx nrx]);
% Give names to the features:
X = set(X,'featlab',['height';'width ']);
% Use now class 2 as target class:
X = oc_set(X,'2');
% Split the data in training and test data:
trnr = 15;
[x,z] = gendat(X,[trnr trnr]);
% Only use target data for training,
x = target_class(x);
% and both classes for testing:
newoutliers = gendatout(x,100);
z = [z;newoutliers];
% Here we go
clf;
% Train several classifiers and plot the ROC curve:
w = parzen_dd(x,0.2);
h = plotroc(dd_roc(z*w),'b');
H(1) = h(1);
w = svdd(x,0.2,5);
h = plotroc(dd_roc(z*w),'r');
H(2) = h(1);
w = lpdd(x,0.2,5,'d',2);
h = plotroc(dd_roc(z*w),'g');
H(3) = h(1);
w = nndd(x,0.2);
h = plotroc(dd_roc(z*w),'y');
H(4) = h(1);
w = kmeans_dd(x,0.2);
h = plotroc(dd_roc(z*w),'m');
H(5) = h(1);
w = knndd(x,0.2,5);
h = plotroc(dd_roc(z*w),'k');
H(6) = h(1);
legend(H,'parzen','svdd','lpdd','nndd','kmeans','knndd')