-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse.py
65 lines (62 loc) · 3.83 KB
/
parse.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
from models import LINKX, MLP
from data_utils import normalize
def parse_method(args, dataset, n, c, d):
if args.method == 'linkx':
model = LINKX(d, args.hidden_channels, c, args.num_layers, dataset.graph['num_nodes'],
inner_activation=args.inner_activation, inner_dropout=args.inner_dropout, dropout=args.dropout, init_layers_A=args.link_init_layers_A, init_layers_X=args.link_init_layers_X)
else:
raise ValueError('Invalid method')
return model
def parser_add_main_args(parser):
parser.add_argument('--dataset', type=str, default='fb100')
parser.add_argument('--sub_dataset', type=str, default='')
parser.add_argument('--hidden_channels', type=int, default=32)
parser.add_argument('--dropout', type=float, default=0.5)
parser.add_argument('--lr', type=float, default=0.01)
parser.add_argument('--method', '-m', type=str, default='link')
parser.add_argument('--epochs', type=int, default=150)
parser.add_argument('--cpu', action='store_true')
parser.add_argument('--weight_decay', type=float, default=1e-3)
parser.add_argument('--display_step', type=int,
default=1, help='how often to print')
parser.add_argument('--hops', type=int, default=1,
help='power of adjacency matrix for certain methods')
parser.add_argument('--num_layers', type=int, default=2,
help='number of layers for deep methods')
parser.add_argument('--runs', type=int, default=1,
help='number of distinct runs')
parser.add_argument('--cached', action='store_true',
help='set to use faster sgc')
parser.add_argument('--gat_heads', type=int, default=8,
help='attention heads for gat')
parser.add_argument('--lp_alpha', type=float, default=.1,
help='alpha for label prop')
parser.add_argument('--gpr_alpha', type=float, default=.1,
help='alpha for gprgnn')
parser.add_argument('--gcn2_alpha', type=float, default=.1,
help='alpha for gcn2')
parser.add_argument('--theta', type=float, default=.5,
help='theta for gcn2')
parser.add_argument('--directed', action='store_true',
help='set to not symmetrize adjacency')
parser.add_argument('--jk_type', type=str, default='max', choices=['max', 'lstm', 'cat'],
help='jumping knowledge type')
parser.add_argument('--rocauc', action='store_true',
help='set the eval function to rocauc')
parser.add_argument('--num_mlp_layers', type=int, default=1,
help='number of mlp layers in h2gcn')
parser.add_argument('--print_prop', action='store_true',
help='print proportions of predicted class')
parser.add_argument('--train_prop', type=float, default=.5,
help='training label proportion')
parser.add_argument('--valid_prop', type=float, default=.25,
help='validation label proportion')
parser.add_argument('--adam', action='store_true', help='use adam instead of adamW')
parser.add_argument('--rand_split', action='store_true', help='use random splits')
parser.add_argument('--no_bn', action='store_true', help='do not use batchnorm')
parser.add_argument('--sampling', action='store_true', help='use neighbor sampling')
parser.add_argument('--inner_activation', action='store_true', help='Whether linkV3 uses inner activation')
parser.add_argument('--inner_dropout', action='store_true', help='Whether linkV3 uses inner dropout')
parser.add_argument("--SGD", action='store_true', help='Use SGD as optimizer')
parser.add_argument('--link_init_layers_A', type=int, default=1)
parser.add_argument('--link_init_layers_X', type=int, default=1)