-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupfd.py
86 lines (64 loc) · 2.62 KB
/
upfd.py
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
from torch_geometric.nn import GATConv, GCNConv, SAGEConv
from faknow.model.social_context.base_gnn import _BaseGNN
from faknow.model.social_context.gcnfn import _BaseGCNFN
class UPFDGCN(_BaseGNN):
"""
User Preference-aware Fake News Detection, SIGIR 2021
paper: https://dl.acm.org/doi/abs/10.1145/3404835.3462990
code: https://github.com/safe-graph/GNN-FakeNews
UPFD model with GCN layer
"""
def __init__(self, feature_size: int, hidden_size=128):
"""
Args:
feature_size (int): dimension of input node feature
hidden_size (int): dimension of hidden layer. Default=128
"""
super().__init__(feature_size, hidden_size, True)
self.conv = GCNConv(self.feature_size, self.hidden_size)
class UPFDSAGE(_BaseGNN):
"""
User Preference-aware Fake News Detection, SIGIR 2021
paper: https://dl.acm.org/doi/abs/10.1145/3404835.3462990
code: https://github.com/safe-graph/GNN-FakeNews
UPFD model with SAGE layer
"""
def __init__(self, feature_size: int, hidden_size=128):
"""
Args:
feature_size (int): dimension of input node feature
hidden_size (int): dimension of hidden layer. Default=128
"""
super().__init__(feature_size, hidden_size, True)
self.conv = SAGEConv(self.feature_size, self.hidden_size)
class UPFDGAT(_BaseGNN):
"""
User Preference-aware Fake News Detection, SIGIR 2021
paper: https://dl.acm.org/doi/abs/10.1145/3404835.3462990
code: https://github.com/safe-graph/GNN-FakeNews
UPFD model with GAT layer
"""
def __init__(self, feature_size: int, hidden_size=128):
"""
Args:
feature_size (int): dimension of input node feature
hidden_size (int): dimension of hidden layer. Default=128
"""
super().__init__(feature_size, hidden_size, True)
self.conv = GATConv(self.feature_size, self.hidden_size)
class UPFDGCNFN(_BaseGCNFN):
"""
User Preference-aware Fake News Detection, SIGIR 2021
paper: https://dl.acm.org/doi/abs/10.1145/3404835.3462990
code: https://github.com/safe-graph/GNN-FakeNews
UPFD model with GCNFN layer
"""
def __init__(self, feature_size: int, hidden_size=128, dropout_ratio=0.5):
"""
Args:
feature_size (int): dimension of input node feature
hidden_size (int): dimension of hidden layer. Default=128
dropout_ratio (float): dropout ratio. Default=0.5
"""
super(UPFDGCNFN, self).__init__(feature_size, hidden_size,
dropout_ratio, True)