-
Notifications
You must be signed in to change notification settings - Fork 1
/
femdbht.m
41 lines (37 loc) · 1.09 KB
/
femdbht.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
function[obj]=femdbht(A,K,S,para,Obs)
% this return object function value for MKCemdb(ht) formulation function solve min C1\sum_m \|Km-AmKmAm\|+ C2\|Am -\sum_lSmlAl\|^2 + C3 \|A\|2_1
% Output:
% obj.T = total objective values = para.c1 obj.K + para.c2 obj.Relevant +para.c3 obj.L21
% obj.K = Loss_within
% obj.L21 = L21 regularization
% obj.Relevant = Loss_between
M=size(K,3);
N=size(K,2);
obj.T=0;
obj.K=0;
%obj.CCA=0;
obj.Relevant=0;
obj.L21=0;
for l =1:1:M
temp(l).T=zeros(size(A,1),size(A,2));
for l2=1:1:M
if l2==l
else
temp(l).T=S(l,l2)*A(:,:,l2);
end
end
temp(l).D=A(Obs(l).id,Obs(l).id,l)*squeeze(K(Obs(l).id,Obs(l).id,l));
temp(l).hatk=temp(l).D*A(Obs(l).id,Obs(l).id,l)';
temp(l).B=K(Obs(l).id,Obs(l).id,l)-temp(l).hatk;
temp(l).E=temp(l).B*temp(l).D;
temp(l).C=A(:,:,l)-temp(l).T;
end
for m=1:1:M
obj.K=obj.K+((normS(K(Obs(m).id,Obs(m).id,m)-temp(m).hatk)^2)/(M*length(Obs(m).id)^2));
for c=1:1:size(A,2)
obj.L21=obj.L21+normS(A(:,c,m))/M;
end
obj.Relevant=obj.Relevant+normS(temp(m).C)^2/(M*N);
end
obj.T=obj.K*para.c1+obj.Relevant*para.c2+obj.L21*para.c3;
end