www.pudn.com > RobustSF.zip > compute_classifier_parametrs.m, change:2014-07-16,size:319b


function [W] = compute_classifier_parametrs( Z1,tr_label) 
 
len1=length(tr_label); 
 
%% 制作训练样本中的标签矩阵H 
numclass=length(unique(tr_label)); 
H=zeros(numclass,len1); 
for il=1:len1 
    H(tr_label(il),il)=1; 
end 
 
%计算线性分类器W 
lambda=1e-4; 
I=eye(size(Z1,1)); 
W=H*Z1'*inv((Z1*Z1'+lambda*I)); 
end