?? target_class.m
字號:
function [a,b] = target_class(a,clnr)% TARGET_CLASS extracts the target class from an one-class dataset%% A = target_class(A,CLNR)%% Extract the target class from an one-class dataset. When the label% CLNR is given, the class indicated by this label is taken.%% [A,B] = target_class(A,CLNR)%% When a second output argument is requested, %% Default: CLNR='target';%% See also: oc_set, gendatoc, find_target, relabel% 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 Netherlandsif (nargin<2) clnr = 'target';end% Be sure we are working with an OC set:[a,I] = oc_set(a,clnr);% Extract just the target objects:It = find(I==1);if isempty(It) error('Cannot find target class objects!');end% On request, also return the outlier objects:% (do this before the construction of the target-class dataset, because% in that construction the outlier data is removed)if nargout>1 Io = find(I==2); b = a(Io,:); %DXD Now the question becomes, should we reduce the lablist to just % 'outlier'?? b = setnlab(b,ones(length(Io),1)); b = setlablist(b); % remove empty classes. b = setlablist(b,'outlier');end% and what it was all about:a = a(It,:);%DXD Now the question becomes, should we reduce the lablist to just% 'target'??a = setlablist(a); % remove empty classes from the lablista = setnlab(a,ones(length(It),1));a = setlablist(a,'target');return
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -