-
Notifications
You must be signed in to change notification settings - Fork 0
/
DPCP_Normal.m
55 lines (52 loc) · 1.27 KB
/
DPCP_Normal.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
function [Xin, precision, recal] = DPCP_Normal(W, p)
%% init parameters.
%display(size(W));
len = size(W, 1);
delta = 10^(-9);
T = 1000;
epsilon_J = 10^(-6);
Xin = cell(1, len);
yf = [0; 0; 0; 0; 0; 1; 0; -1; 0];
precision = 0;
recal = 0;
for i = 1:len
tmpWi = W(i, :, :);
Nc = size(W, 3);
fenjie = Nc * p;
Wi = zeros(8, Nc);
Wi(:,:) = tmpWi(1, :, :);
X = Wi;
[f, distance, time] = DPCP_IRLS_modified(X, delta, -1, epsilon_J, 2);
tSum = norm(distance, 1);
%% plot
%display(normc(f));
pX = 1:Nc;
%display(pX);
%display(size(normc(f)'*X));
%figure; subplot(1,1,1); stem(pX, distance');
%title('normal-subspace distance for each embedding to Span(h)^\perp');
%%
tmpXin = [];
%display(size(distance));
%display((distance));
% display(f);
% display(distance(1));
TP = 0;
lq = max(((tSum / (2 * Nc)) * 0.3), 2);
for j = 1:Nc
if distance(j) <= lq
if j < fenjie
TP = TP + 1;
end
tmpXin = [tmpXin , Wi(:,j)];
end
end
precision = precision + (TP) / size(tmpXin, 2);
recal = recal + (TP) / (fenjie - 1);
%display(size(tmpXin));
Xin{1} = tmpXin;
end
%display(Xin);
precision = precision / len;
recal = recal / len;
end