-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathincompleteLateFusionMKCOrthHp_lambda.m
54 lines (48 loc) · 1.69 KB
/
incompleteLateFusionMKCOrthHp_lambda.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
function [H_normalized,WP,HP,beta,obj] = incompleteLateFusionMKCOrthHp_lambda(KH,S,k,qnorm,lambda)
num = size(KH, 2); %the number of samples
numker = size(KH, 3); %m represents the number of kernels
maxIter = 100; %the number of iterations
[HP,WP] = myInitializationHp(KH,S,k);
HP00 = HP;
beta = ones(numker,1)*(1/numker)^(1/qnorm);
%%%---H0
KA = feval('algorithm2',KH,S);
%% combining the base kernels
KC = mycombFun(KA,beta);
H0 = mykernelkmeans(KC,k);
%%%%%%%%%%
flag = 1;
iter = 0;
RpHpwp = zeros(num,k); % k - clusters, N - samples
for p=1:numker
RpHpwp = RpHpwp + beta(p)*(HP(:,:,p)*WP(:,:,p));
end
RpHpwp_lambda = RpHpwp +lambda*H0;
while flag
iter = iter +1;
%---the first step-- optimize H_star with given (HP, WP and beta)
[Uh,Sh,Vh] = svd(RpHpwp_lambda,'econ');
Hstar = Uh*Vh';
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% res90(iter,:) = myNMIACC(Hstar,Y,k);
%---the second step-- optimize WP with (HP, H_star and beta)
WP = updateWPabsentClusteringV1(HP,Hstar);
%---the third step-- optimize HP with (WP, H_star and beta)
HP = updateHPabsentClusteringOrthHp(WP,Hstar,S,HP00);
%---the fourth step-- optimize beta with (WP, H_star and HP)
beta = updateBetaAbsentClustering(HP,WP,Hstar,qnorm);
%---Calculate Obj--
RpHpwp = zeros(num,k);
for p = 1:numker
RpHpwp = RpHpwp + beta(p)*HP(:,:,p)*WP(:,:,p);
end
RpHpwp_lambda = RpHpwp +lambda*H0;
obj(iter) = trace(Hstar'*RpHpwp_lambda);
if (iter>2) && (abs((obj(iter)-obj(iter-1))/(obj(iter)))<1e-4 || iter>maxIter)
flag =0;
end
% if (iter>2) && (iter>maxIter)
% flag =0;
% end
end
H_normalized = Hstar./ repmat(sqrt(sum(Hstar.^2, 2)), 1,k);