www.pudn.com > RobustSF.zip > testSupervised.asv, change:2014-09-20,size:1295b


 
%% load data 
% downsample=3; 
% path=fullfile('E:\算法代码\实验AR - 统计时间-ourmethod',sprintf('Data_Mixed_downsample%d',downsample),num2str(1)); 
% %     path=fullfile('E:\算法代码\实验AR - 统计时间-ourmethod',sprintf('Data_Scraf_downsample%d',downsample),num2str(i)); 
% %     path=fullfile('E:\算法代码\实验AR - 统计时间-ourmethod',sprintf('Data_sumglass_downsample%d',downsample),num2str(i)); 
% load(fullfile(path,'ts_label.mat')); 
% load(fullfile(path,'tr_label.mat')); 
% load(fullfile(path,'X1.mat')); 
% load(fullfile(path,'X2.mat')); 
 
 
%% Step4. 生成H 
nclass=length(unique(tr_label)); 
m=length(tr_label); 
H=zeros(nclass,m); 
for il=1:m 
    H(tr_label(il),il)=1; 
end 
 
%% Step5. 生成L 
L=compute_laplase(X1,tr_label); 
 
%% Step6. 开始学习字典和低秩表示 
% min ||H-WX||_F^2+\lambda||W||_F^2+\alpha||A||_*+\beta||E||_1+gamma tr(AZA^T) 
%     s.t. Y=A+E 
lambda=0.1; 
alpha=0.01; 
beta=0.1; 
gamma=0.01; 
tol=1-6; 
max_iter=500; 
 
[A,U] = DictionaryLearning(X1, H, L, lambda, alpha, beta, gamma, tol, max_iter); 
 
[W] = compute_classifier_parametrs(A, tr_label); 
 
Z2=U*(U'*X2); 
% Z2= NormalizeFea(Z2,0); 
[acc] = predic_labels( Z2,ts_label,W); 
 
fprintf('Dictionary: %f\n',acc); 
 
lambda=0.012 
[U_hat,~,~,A,~,~] = inexact_alm_rpca(X1, lambda, tol, max_iter, rho)