-
Notifications
You must be signed in to change notification settings - Fork 6
/
config_citation.py
347 lines (316 loc) · 8.98 KB
/
config_citation.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
import time
from os import cpu_count
from copy import deepcopy
import tensorflow as tf
default = {
# Dataset and split
'dataset' : 'cora', # 'Dataset (cora | citeseer | pubmed | large_cora | nell.0.1 | nell.0.01 | nell.0.001)
'shuffle' : True, # random split or not
'train_size' : 4, # if train_size is a number, then use TRAIN_SIZE labels per class.
# 'train_size' : [4, 6, 8, 10, 20, 20, 20],
'validation_size' : 500, # 'Use VALIDATION_SIZE data to train model'
'validate' : False, # Whether use validation set
'test_size' : None, # If None, all rest are test set
'feature' : 'bow', # 'bow' | 'tfidf' | 'none'.
# proto weights for GCN
'k' : 0,
'use_proto' : False,
'outputs_weight' : [1],
#'outputs_weight' : [1, 1, 1, 1, 1, 1],
#'outs_weight' : [0, 0.1, 0.1, 0.6, 0.8, 1],
#'outs_softmax_weight': [0, 0, 0.1, 0.1, 0.1, 0.1],
'Model' : 'IGCN', # 'LP', 'IGCN', 'GLP', 'MLP'
# 'alpha' in LP
'alpha' : 10,
# Neural Network Setting
'connection' : 'cc',
# A string contains only char "c" or "f"
# "c" stands for convolution.
# "f" stands for fully connected.
'layer_size' : [16],
# A list or any sequential object. Describe the size of each layer.
# e.g. "--connection ccd --layer_size [7,8]"
# This combination describe a network as follow:
# input_layer --convolution-> 7 nodes --convolution-> 8 nodes --dense-> output_layer
# (or say: input_layer -c-> 7 -c-> 8 -d-> output_layer)
# graph conv in layers
'conv_config' : [{
'conv' : 'rnm', # rnm, rw, ap
'k' : 1,
'alpha' : 10,
} for _ in range(2)],
'optimizer' : tf.train.AdamOptimizer,
'learning_rate' : 0.01, # 'Initial learning rate.'
'epochs' : 200, # 'Number of epochs to train.'
'dropout' : 0.5, # 'Dropout rate (1 - keep probability).'
'weight_decay' : 5e-4, # 'Weight for L2 loss on embedding matrix.'
# Filter as pre-processing
'smooth_config' :{
'type' : None, # 'taubin' | None | 'ap_appro'
'alpha' : 10, # alpha for AR filter
'k' : 2, # k for RNM and RW filter
},
'logging' : False, # 'Weather or not to record log'
'logdir' : '', # 'Log directory.''
'name' : None, # 'name of the model. Serve as an ID of model.'
'save_feature' : 'saved_features.txt',
'random_seed' : int(time.time()), # 'Random seed.'
'threads' : cpu_count(), #'Number of threads'
'train' : True,
}
repeat = 1
one_label_set ={
# repeating times
'repeating': repeat,
# The default model configuration
'default': deepcopy(default),
# The list of model to be train.
# Only configurations that's different with default are specified here
'model_list': [
# MLP
{
'Model': 'MLP',
'name' : 'MLP',
'connection': 'ff',
},
# LP
{
'Model': 'LP',
'name' : 'LP',
'alpha': 100,
},
#GCN
{
'Model': 'IGCN', # GCN is a special case of IGCN
'name' : 'GCN'
},
]
+ [
# IGCN(RNM)
{
'Model': 'IGCN',
'name' : 'IGCN_RNM',
'connection': 'cc',
'conv_config': [
{
'conv': 'rnm',
'k': 10 // 2,
},
{
'conv': 'rnm',
'k': 10 // 2,
}],
},
# IGCN(AR)
{
'Model': 'IGCN',
'name' : 'IGCN_AR',
'connection': 'cc',
'conv_config': [
{
'conv': 'ap',
'alpha': 20//2,
},
{
'conv': 'ap',
'alpha': 20//2,
}]
}
]
# GLP
+ [
# GLP(RNM)
{
'Model': 'GLP',
'name' : 'GLP_RNM',
'connection': 'ff',
'smooth_config':
{
'type': 'rnm',
'k': 10,
}
},
# GLP(AR)
{
'Model': 'GLP',
'name' : 'GLP_AR',
'connection': 'ff',
'smooth_config':
{
'type': 'ap_appro',
'alpha': 20,
}
}
]
}
one_label_set['default'].update({'train_size': 1})
two_label_set ={
# repeating times
'repeating': repeat,
# The default model configuration
'default': deepcopy(default),
# The list of model to be train.
# Only configurations that's different with default are specified here
'model_list': [
# MLP
{
'Model': 'MLP',
'name' : 'MLP',
'connection': 'ff',
},
# LP
{
'Model': 'LP',
'name' : 'LP',
'alpha': 100,
},
#GCN
{
'Model': 'IGCN', # GCN is a special case of IGCN
'name' : 'GCN'
},
]
+ [
# IGCN(RNM)
{
'Model': 'IGCN',
'name' : 'IGCN_RNM',
'connection': 'cc',
'conv_config': [
{
'conv': 'rnm',
'k': 10 // 2,
},
{
'conv': 'rnm',
'k': 10 // 2,
}],
},
# IGCN(AR)
{
'Model': 'IGCN',
'name' : 'IGCN_AR',
'connection': 'cc',
'conv_config': [
{
'conv': 'ap',
'alpha': 20//2,
},
{
'conv': 'ap',
'alpha': 20//2,
}]
}
]
# GLP
+ [
# GLP(RNM)
{
'Model': 'GLP',
'name' : 'GLP_RNM',
'connection': 'ff',
'smooth_config':
{
'type': 'rnm',
'k': 10,
}
},
# GLP(AR)
{
'Model': 'GLP',
'name' : 'GLP_AR',
'connection': 'ff',
'smooth_config':
{
'type': 'ap_appro',
'alpha': 20,
}
}
]
}
two_label_set['default'].update({'train_size': 2})
five_label_set ={
# repeating times
'repeating': repeat,
# The default model configuration
'default': deepcopy(default),
# The list of model to be train.
# Only configurations that's different with default are specified here
'model_list': [
# MLP
{
'Model': 'MLP',
'name' : 'MLP',
'connection': 'ff',
},
# LP
{
'Model': 'LP',
'name' : 'LP',
'alpha': 100,
},
#GCN
{
'Model': 'IGCN', # GCN is a special case of IGCN
'name' : 'GCN'
},
]
+ [
# IGCN(RNM)
{
'Model': 'IGCN',
'name' : 'IGCN_RNM',
'connection': 'cc',
'conv_config': [
{
'conv': 'rnm',
'k': 10 // 2,
},
{
'conv': 'rnm',
'k': 10 // 2,
}],
},
# IGCN(AR)
{
'Model': 'IGCN',
'name' : 'IGCN_AR',
'connection': 'cc',
'conv_config': [
{
'conv': 'ap',
'alpha': 20//2,
},
{
'conv': 'ap',
'alpha': 20//2,
}]
}
]
# GLP
+ [
# GLP(RNM)
{
'Model': 'GLP',
'name' : 'GLP_RNM',
'connection': 'ff',
'smooth_config':
{
'type': 'rnm',
'k': 10,
}
},
# GLP(AR)
{
'Model': 'GLP',
'name' : 'GLP_AR',
'connection': 'ff',
'smooth_config':
{
'type': 'ap_appro',
'alpha': 20,
}
}
]
}
five_label_set['default'].update({'train_size': 5})