-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathis_ocset.m
More file actions
executable file
·48 lines (43 loc) · 1.04 KB
/
is_ocset.m
File metadata and controls
executable file
·48 lines (43 loc) · 1.04 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
%IS_OCSET True for one-class datasets
%
% N = IS_OCSET(A)
%
% INPUT
% A Dataset
%
% OUTPUT
% N 0/1 if A isn't/is a one-class dataset
%
% DESCRIPTION
% IS_OCSET(A) returns true if the dataset a is a one-class dataset,
% containing only classes 'target' and/or 'outlier'.
%
% SEE ALSO
% isocset, is_occ, isocc
% 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
function out = is_ocset(a)
if ~isdataset(a)
out = 0;
else
[l,lablist] = getnlab(a);
switch size(lablist,1)
case 1
out = strcmp(lablist,'target')|...
strcmp(lablist,'target ')|...
strcmp(lablist,'outlier');
case 2
out1 = all(strcmp(lablist,['outlier';'target ']));
out2 = all(strcmp(lablist,['target ';'outlier']));
out = out1 || out2;
otherwise
out = 0;
end
end
if nargout==0
if out==0
error('Dataset A is NOT a one-class dataset.');
end
clear out;
end