?? multic.m
字號:
%MULTIC Make a multi-class classifier%% W = MULTIC(A,V)%% Train the (untrained!) one-class classifier V on each of the classes% in A, and combine it to a multi-class classifier W. If an object is% rejected by all one-class classifiers, it will be classified% 'outlier'. If it is accepted by more than one one-class classifier, it% will be assigned to the class with the highest class posterior.%% Frustratingly, it can happen that the class labels are numbers. In% that case the outlier class will have a 0. For datasets with string% class labels, the outlier class will be called 'outlier'.%% W = MULTIC(A,{V1 V2 ... VK})% % The trained one-class classifiers V1...VK are combined to a multiclass% classifier W.%% See also dd_normc, myproxm% 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 w = multic(a,w)[n,k,c] = getsize(a);% Hmm, labels can be numbers... Make sure that the correct label for the% outlier class is used.ll = getlablist(a);if isa(ll,'double')% rejlabel = max(ll)+1; rejlabel = 0;else rejlabel = [];end% Train the one-class classifiers (if needed) and fix the class labels% for the multi-class classifier.for i=1:c x = target_class(a,i); if length(w)==1 if istrained(w) error('Please supply one untrained one-class mapping.'); end W{i} = x*w*dd_normc; else if isuntrained(w{i}) W{i} = x*w{i}*dd_normc; else W{i} = w{i}; end end if isempty(rejlabel) W{i} = setlabels(W{i},ll(i,:),1); else W{i} = setlabels(W{i},[ll(i); rejlabel]); endend% The final classifier is a fixed combiner:w = [W{:}]*minc;return
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -