-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSkillForgOthers.m
More file actions
102 lines (96 loc) · 1.96 KB
/
SkillForgOthers.m
File metadata and controls
102 lines (96 loc) · 1.96 KB
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
function [ xi,xj,y,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=ng_*nf_*(Total-1)
RandomforOne=(ng*nf*(Total-1))
RandomforOthers=0
xis= GenP + GenOthers + Skilled + RandomforOne + RandomforOthers
xi=zeros(xis,N); 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)';
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)';
y(c,:)=1;
end
end
end
end
%% skilled Forgery
for p_=1:Total
% p_;
if p_~=p
for i=1:ng_
for j=28:27+nf_
c=c+1;
xi(c,:)=reshape(X(p_,:,i),N,1,1)';
xj(c,:)=reshape(X(p_,:,j),N,1,1)';
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)';
y(c,:)=-1;
end
end
end
end
%% Test
xis= (ng*(27-ng)) + 45*ng ;% + (Total-1)*(ng*72);
xi_t=zeros(xis,N); xj_t=xi_t; y_t=zeros(xis,1);
c=0;
% Genuine
for j=ng+1:27
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
% Skilled Forgery
for j=28: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
% Random Forgery
% for p_=1:Total
% if p_~=p
% for j=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