-
Notifications
You must be signed in to change notification settings - Fork 4
/
SkillForgOthers_random_test_randomForg.m
107 lines (105 loc) · 2.32 KB
/
SkillForgOthers_random_test_randomForg.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function [ xi_t,xj_t,y_t ] = SkillForgOthers(X,p,ng,nf,ng_,nf_)
Total=115;
N=size(X,2);
% GenP=((ng)*(ng-1)/2 )+ng
% GenOthers=((ng_*(ng_-1)/2 )+ng_)*(Total-1)
% Skilled=0 ; %ng_*nf_*(Total-1)
% RandomforOne=(ng*nf*(Total-1))
% RandomforOthers=(ng_*nf_)*(((Total-2)*(Total-3)/2)+Total-2)
% xis= GenP + GenOthers + Skilled + RandomforOne + RandomforOthers
% xi=zeros(xis,2); xj=xi; y=zeros(xis,1);
% c=0;
% %% Genuine
% for p_=1:Total
% % p_
% if p_==p
% for i=1:ng
% for j=i:ng
% c=c+1;
% % xi(c,:)=reshape(X(p_,:,i),N,1,1)';
% % xj(c,:)=reshape(X(p_,:,j),N,1,1)';
% xi(c,:)=[p_ i];
% xj(c,:)=[p_ j];
% y(c,:)=1;
% end
% end
% else
% for i=1:ng_
% for j=i:ng_
% c=c+1;
% % xi(c,:)=reshape(X(p_,:,i),N,1,1)';
% % xj(c,:)=reshape(X(p_,:,j),N,1,1)';
% xi(c,:)=[p_ i];
% xj(c,:)=[p_ j];
% y(c,:)=1;
% end
% end
% end
% end
%
% %% skilled Forgery
% % for p_=1:Total
% % % p_;
% % if p_~=p
% % for i=1:ng_
% % for j=16:15+nf_
% % c=c+1;
% % % xi(c,:)=reshape(X(p_,:,i),N,1,1)';
% % % xj(c,:)=reshape(X(p_,:,j),N,1,1)';
% % xi(c,:)=[p_ i];
% % xj(c,:)=[p_ j];
% % y(c,:)=-1;
% % end
% % end
% % end
% % end
%
%
% %% Random Forgery just for p vs others
% for i=1:ng
% for p_=1:Total
% if p_~=p
% for j=1:nf
% c=c+1;
% % xi(c,:)=reshape(X(p,:,i),N,1,1)';
% % xj(c,:)=reshape(X(p_,:,j),N,1,1)';
% xi(c,:)=[p i];
% xj(c,:)=[p_ j];
% y(c,:)=-1;
% end
% end
% end
% end
% % Random Forgery for Others
% for p_g=1:Total
% for p_=p_g+1:Total
% if p_~=p && p_g~=p
% for i=1:ng_
% for j=1:nf_
% c=c+1;
% xi(c,:)=[p_g i];
% xj(c,:)=[p_ j];
% y(c,:)=-1;
% end
% end
% end
% end
% end
%% Test
xis= (Total-1)*(72-ng_)*ng ;% + (Total-1)*(ng*30);
xi_t=zeros(xis,N); xj_t=xi_t; y_t=zeros(xis,1);
c=0;
% Genuine
% Random Forgery
for p_=1:Total
if p_~=p
for j=ng_+1:72
for i=1:ng
c=c+1;
xi_t(c,:)=reshape(X(p,:,i),N,1,1)';
xj_t(c,:)=reshape(X(p_,:,j),N,1,1)';
y_t(c,:)=-1;
end
end
end
end