⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oc_set.m

📁 模式识别工具箱,希望对大家有用!
💻 M
字号:
function a = oc_set(a,clnr)% OC_SET  makes an one-class dataset%% A = oc_set(A,clnr)%% Change a normal dataset A into an one-class dataset: the class% indicated by the classnr (clnr) is made target class and all other% data becomes outliers class. The labels are changed to 'target' and% 'outlier'.%% It is also possible to use a class label:%% A = oc_set(A,label)%% but then the type of the label should be a char (else you cannot% distinguish it from a class number, can you?:-))% 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 Netherlandsif (nargin<2)  clnr = 1;end% match the labellist type with the clnr[nlab,lablist,m,k,c] = dataset(a);if isa(clnr,'char')  if isa(lablist,'double')    [nlab,clnr] = renumlab(getlab(a),str2num(clnr));  else % lablist is character    [nlab,clnr] = renumlab(getlab(a),clnr);  endend% make the new labels:lablist =  str2mat('target', 'outlier');laba = ones(m,size(lablist,2));I = find(nlab==clnr);laba(I,:) = ones(length(I),1)*lablist(1,:);I = find(nlab~=clnr);laba(I,:) = ones(length(I),1)*lablist(2,:);a = dataset(+a,char(laba));return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -