1function [CC]=untrain_sc(CC,classlabel,x) 2% UnTrain - decrementaal learning (untraining) of classifier 3% 4% CC = untrain_sc(CC,classlabel,x) 5% 6% CC is a statistical classifier, it contains basically the mean 7% and the covariance of the data of each class. This information 8% is incoded in the so-called "extended covariance matrices". 9% 10% CC can be used for various statistical classifiers included 11% LDA, MDA, QDA, GRB, etc. 12% 13% see also: TEST_SC, COVM, LDBC2, LDBC3, LDBC4, MDBC, GDBC 14 15% $Id$ 16% Copyright (C) 2005 by Alois Schloegl <alois.schloegl@gmail.com> 17% This is part of the BIOSIG-toolbox http://biosig.sf.net/ 18 19% This program is free software; you can redistribute it and/or 20% modify it under the terms of the GNU General Public License 21% as published by the Free Software Foundation; either version 2 22% of the License, or (at your option) any later version. 23% 24% This program is distributed in the hope that it will be useful, 25% but WITHOUT ANY WARRANTY; without even the implied warranty of 26% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27% GNU General Public License for more details. 28% 29% You should have received a copy of the GNU General Public License 30% along with this program; if not, write to the Free Software 31% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 32 33 34if (length(classlabel)~=size(x,1)) & any(size(classlabel)~=1), 35 error('length of classlabel must be a scalar or must fit size of data (number of rows)'); 36end; 37 38if strcmp(CC.datatype,'classifier:statistical'); 39 if all(classlabel==classlabel(1)), 40 [md,nn] = covm(x,'E'); 41 k = find(CC.Labels==classlabel(1)); 42 CC.MD(k,:,:) = CC.MD(k,:,:) - md; 43 CC.NN(k,:,:) = CC.NN(k,:,:) - nn; 44 else 45 Labels = unique(classlabel(~isnan(classlabel))); 46 for k = 1:length(Labels), 47 [md,nn] = covm(x(classlabel==Labels(k),:),'E'); 48 49 ix = find(CC.Labels==Labels(k)); 50 CC.MD(ix,:,:) = CC.MD(ix,:,:) - md; 51 CC.NN(ix,:,:) = CC.NN(ix,:,:) - nn; 52 end 53 end; 54 55elseif strcmp(CC.datatype,'classifier:SVM'); 56 error('decremental learning not implemented for SVM (yet)'); 57 58end;