-
Notifications
You must be signed in to change notification settings - Fork 0
/
saveEvaluateGoodMethodLRR_better.m
58 lines (53 loc) · 1.45 KB
/
saveEvaluateGoodMethodLRR_better.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
clear
start_up
parpool(4)
clc
% dataset1=[pwd '\dataset\ORL_32x32.mat'];
% dataset1=[pwd '\dataset\Yale_32x32.mat'];
dataset1=[pwd '\dataset\YaleB_32x32.mat'];
load(dataset1)
randlist=round(rand(1, 400)*size(fea, 1))%yaleB
fea= fea(randlist, :)%yaleB
gnd= gnd(randlist, :)%yaleB
% method_name='RPCA';
% output=[pwd '\output_lrr\ORL'];
% output=[pwd '\output_lrr\Yale'];
output=[pwd '\output_lrr\YaleB'];
if exist(output,'dir')==0
mkdir(output);
end
faceW = 32;
faceH = 32;
X=fea';
method_name='LRR';
load('goodMethod_LRR.mat')
algorithmlist=goodMethod_lrr
algorithm_start=1
algorithm_end=length(algorithmlist)
% algorithm_end=1
for i=algorithm_start:algorithm_end
algorithm_id1=algorithmlist{i, 1}
algorithm_id2=algorithmlist{i, 2}
algorithm_name=[algorithm_id1 '_' algorithm_id2];
fileName=fullfile(output,algorithm_name);
result1=process_matrix(method_name,algorithm_id1, X, []);
X_err=result1.S;
X_L=result1.L;
min_X_L=min(min(X_L))
% min_X_err=min(min(X_err))
% min_min=min(min_X_L, min_X_err)
% if min_min<0
% X_L=X_L+abs(min_min);
% X_err=X_L+abs(min_min)
% end
if min_X_L<0
X_L=X_L+abs(min_X_L);
end
opts2.rows =size(X_L,1);
opts2.cols=size(X_L,2);
result2=process_matrix(method_name,algorithm_id2, X_L, []);
X_com=result2.L;
X_diff=result2.S;
saveDecomposeImg(X, X_com, X_diff, X_err, fileName)
saveClusteringImg(X, X_com, X_diff, fileName, gnd)
end