📄 find_target.m
字号:
%FIND_TARGET extract the indices of the target and outlier objects
%
% [It,Io] = FIND_TARGET(A)
%
% Return the indices of the objects from dataset A which are labeled
% 'target' and 'outlier' in the index vectors It and Io
% respectively. A warning is given when no target objects can be
% found.
%
% See also: isocset, gendatoc, oc_set
% Copyright: D.M.J. 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
function [I1,I2] = find_target(a)
% Check that we are dealing with a one-class dataset
if ~is_ocset(a)
error('Dataset is not a one-class dataset');
end
% first find the target objects:
[nlab,lablist] = getnlab(a);
nr_t = strmatch('target',lablist);
if isempty(nr_t)
warning('Cannot find target objects in dataset.');
I1 = [];
else
I1 = find(nlab==nr_t);
end
% if requested, also find the outliers:
if (nargout>1)
nr_o = strmatch('outlier',lablist);
if isempty(nr_o)
I2 = [];
else
I2 = find(nlab==nr_o);
end
end
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -