-
Notifications
You must be signed in to change notification settings - Fork 3
/
finetune_main.m
59 lines (47 loc) · 1.33 KB
/
finetune_main.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
59
clear
load('YALE_165n_1024d_15c_uni.mat');
X=X';
[m,n]=size(X);
k=10;
%mu = .5;
%alpha = 0.01;
%beta = 0.01;
alphalist=1/sqrt(max([m n]));
% alphalist=[1 20 ];
betalist = [1 20];
mulist = [1 20 ];
Y1 =zeros(m,n) ;
Y2 =zeros(m,n) ;
E = zeros(m,n);
Z = X;
c = length(unique(y));
distX = L2_distance_1(X,X);
[distX1, idx] = sort(distX,2);
for ii = 1:length(alphalist)
alpha = alphalist(ii);
for jj = 1:length(betalist)
beta = betalist(jj);
[gamma] = cal_gamma(X,distX1,beta,k);
for ij = 1:length(mulist)
mu= mulist(ij);
disp([alpha,beta,mu])
for i = 1:200
D = updateD(E,X,Y1,Y2,mu,Z,gamma);
distX = L2_distance_1(D,D);
[distX1, idx] = sort(distX,2);
[gamma] = cal_gamma(D,distX1,beta,k);
E = updateE(D,E,X,Y1,mu,alpha);
S = updateS(X,distX1,idx,k,gamma,beta);
S=(S+S')/2;
L = diag(sum(S))-S;
Z = updateZ(L,beta,mu,D,Y2);
Y1 = Y1+mu*(D+E-X);
Y2 = Y2+mu*(D-Z);
mu=mu*1.1;
end
actual_ids = spectral_clustering(S, c);
result=ClusteringMeasure(actual_ids ,y)
dlmwrite('tdt2.txt',[alpha,beta,mulist(ij),result],'-append','delimiter','\t','newline','pc');
end
end
end