-
Notifications
You must be signed in to change notification settings - Fork 6
/
args.py
167 lines (156 loc) · 7.62 KB
/
args.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import argparse
import torch
noise_choices = [
'None',
'gaussian',
'gaussian_mimic',
'add_gaussian',
'add_gaussian_mimic',
'superimpose_gaussian',
'superimpose_gaussian_class',
'superimpose_gaussian_random',
'zero_test'
]
normalization_choices = [
'',
'AugNormAdj',
'LeftNorm',
'InvLap',
'CombLap',
'SymNormLap',
'AbsAdj'
]
# "All neural network models should go to work at Victoria's Secret
# so the VS models would be here, with us."
sexy_models = [
'SGC',
'GCN',
'KGCN',
'SLG',
'gfnn'
]
preps = [
'',
'GFT'
]
def get_feat_args():
parser = argparse.ArgumentParser()
parser.add_argument('--no-cuda', action='store_true', default=False,
help='Disables CUDA training.')
parser.add_argument('--seed', type=int, default=1, help='Random seed.')
parser.add_argument('--epochs', type=int, default=50,
help='Number of epochs to train.')
parser.add_argument('--lr', type=float, default=0.1,
help='Initial learning rate.')
parser.add_argument('--weight_decay', type=float, default=1e-4,
help='Weight decay (L2 loss on parameters).')
parser.add_argument('--hidden', type=int, default=32,
help='Number of hidden units.')
parser.add_argument('--dropout', type=float, default=0,
help='Dropout rate (1 - keep probability).')
parser.add_argument('--model', type=str, default="SGC",
choices=sexy_models,
help='model to use.')
parser.add_argument('--feature', type=str, default="mul",
choices=['mul', 'cat', 'adj'],
help='feature-type')
parser.add_argument('--normalization', type=str, default='LeftNorm',
choices=normalization_choices,
help='Normalization method for the adjacency matrix.')
parser.add_argument('--invlap_alpha', type=float, default=0.5,
help='alpha parameter for InvLap norm.')
parser.add_argument('--degree', type=int, default=2,
help='degree of the approximation.')
parser.add_argument('--noise', type=str, default='None',
choices=noise_choices, help='noise settings')
parser.add_argument('--preprocess', type=str, choices=preps, default="GFT")
parser.add_argument('--num_component', type=int, default=1)
parser.add_argument('--first_component', type=int, default=0)
parser.add_argument('--batch_size', type=int, default=32)
parser.add_argument('--shuffle', action='store_true')
args, _ = parser.parse_known_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()
return args
def get_syn_args():
parser = argparse.ArgumentParser()
parser.add_argument('--no-cuda', action='store_true', default=False,
help='Disables CUDA training.')
parser.add_argument('--seed', type=int, default=1, help='Random seed.')
parser.add_argument('--epochs', type=int, default=50,
help='Number of epochs to train.')
parser.add_argument('--lr', type=float, default=0.2,
help='Initial learning rate.')
parser.add_argument('--weight_decay', type=float, default=5e-6,
help='Weight decay (L2 loss on parameters).')
parser.add_argument('--hidden', type=int, default=32,
help='Number of hidden units.')
parser.add_argument('--dropout', type=float, default=0,
help='Dropout rate (1 - keep probability).')
parser.add_argument('--data', type=str, default="bicircle",
help='Data shape to generate.')
parser.add_argument('--model', type=str, default="SGC",
choices=sexy_models,
help='model to use.')
parser.add_argument('--feature', type=str, default="mul",
choices=['mul', 'cat', 'adj'],
help='feature-type')
parser.add_argument('--normalization', type=str, default='LeftNorm',
choices=normalization_choices,
help='Normalization method for the adjacency matrix.')
parser.add_argument('--invlap_alpha', type=float, default=0.5,
help='alpha parameter for InvLap norm.')
parser.add_argument('--degree', type=int, default=2,
help='degree of the approximation.')
parser.add_argument('--per', type=int, default=-1,
help='Number of each nodes so as to balance.')
parser.add_argument('--noise', type=str, default='None',
choices=noise_choices, help='noise settings')
parser.add_argument('--gaussian_opt', type=float, nargs=2,
default=[0.0, 1.0], help="mean and var for gaussian")
parser.add_argument('--gen_num_samples', type=int, default=4000,
help='Number of synthetic sample to generate.')
parser.add_argument('--gen_noise', type=float, default=0.2,
help='Amount of noise added to generated samples')
parser.add_argument('--gen_factor', type=float, default=0.5,
help='Scaling factor for circle data generation.')
parser.add_argument('--gen_test_size', type=float, default=0.98,
help='Amount of data to be used as test.')
parser.add_argument('--gen_num_neigh', type=int, default=5,
help='Number of neighbors to build the graph.')
parser.add_argument('--gen_mesh', action='store_true',
help='Generate a mesh for coutour plots')
parser.add_argument('--gen_mesh_step', type=float, default=0.02,
help='Number of steps for the mesh')
parser.add_argument('--batch_size', type=int, default=32)
parser.add_argument('--shuffle', action='store_true')
args, _ = parser.parse_known_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()
return args
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--no-cuda', action='store_true', default=False,
help='Disables CUDA training.')
parser.add_argument('--seed', type=int, default=1, help='Random seed.')
parser.add_argument('--epochs', type=int, default=200,
help='Number of epochs to train.')
parser.add_argument('--lr', type=float, default=0.001,
help='Initial learning rate.')
parser.add_argument('--weight_decay', type=float, default=1e-5,
help='Weight decay (L2 loss on parameters).')
parser.add_argument('--hidden', type=int, default=32,
help='Number of hidden units.')
parser.add_argument('--dropout', type=float, default=0,
help='Dropout rate (1 - keep probability).')
parser.add_argument('--dataset', type=str, default="cora",
help='Dataset to use.')
parser.add_argument('--normalization', type=str, default='RwAdj',
choices=normalization_choices,
help='Normalization method for the adjacency matrix.')
parser.add_argument('--degree', type=int, default=2,
help='degree of the approximation.')
parser.add_argument('--per', type=int, default=-1,
help='Number of each nodes so as to balance.')
parser.add_argument('--batch_size', type=int, default=32)
args, _ = parser.parse_known_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()
return args