-
Notifications
You must be signed in to change notification settings - Fork 1
/
runCMSR.m
51 lines (45 loc) · 1.34 KB
/
runCMSR.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
function label = runCMSR(X, cntCls,alpha ,beta,lambda,gama,knn,p)
%%
maxIters = 100;
nView = length(X); % ÊÓͼÊý
nSample = size(X{1},2); % Ñù±¾Êý
mu = 1;
Y = zeros(nSample);
S = zeros(nSample);
max_mu = 10^6;
rho = 1.5;
Obj = [];
%% Initialization
[L,G] = constructG(X, knn, nView, nSample);
[C,E,sumL,sumHH] = Initialization(X,L,G,nView, nSample); %S=G
temp_inv = cell(1,nView);
temp = cell(1,nView);
%% Alternate minizing strategy
for t = 1:maxIters
%% ------------- update H-------------
H=solveH(alpha,E,S,X,nView, nSample);
L=constructL(H, knn, nView, nSample);
%% ------------- update S -------------
S = solveS(alpha,sumHH,sumL , L, H, C, E, Y, mu, beta, nView, nSample);
%% ------------- update C -------------
C = solveC(S, Y, mu, lambda,p);
%% ------------- update E -------------
for v = 1:nView
temp{v}=alpha*H{v}' * H{v} + gama*eye(nSample);
temp_inv{v}=inv(temp{v});
end
E = solveE(alpha,H, S, temp_inv, nView, nSample);
%% ------------- update Y -------------
Y = Y + mu*(S-C);
mu = min(max_mu,rho*mu);
%% check convergence
err = S-C;
err2= max(abs(err(:)));
Obj(t)=err2;
if err2 < 1e-4 && t>15
break;
end
end
%%
W = (C'+C)/2;
[label, ~] = SpectralClustering(W, cntCls);