-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
38 lines (31 loc) · 1.91 KB
/
main.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
from __future__ import print_function
from Predictor import Predictor
import flags
flags.DEFINE_string('dataset', 'cora', '[cora, citeseer]')
flags.DEFINE_string('subgraph', 'subgraph/', 'Directory of all subgraphs, each file is a subgraph')
flags.DEFINE_string('graph', 'graph.txt', 'Edge list of the complete graph')
flags.DEFINE_string('kernel', 'kernel.json', 'Kernels to be matched')
flags.DEFINE_string('query', 'query', 'Used to create query files used by SubMatch')
flags.DEFINE_string('meta', 'meta/', 'Directory of matched instances of kernels')
flags.DEFINE_string('data', 'data.txt', None)
flags.DEFINE_string('feature', 'feature.txt', None)
flags.DEFINE_string('label', 'label.txt', None)
flags.DEFINE_boolean('use_feature', True, 'Use feature or not')
flags.DEFINE_boolean('use_embedding', True, 'Use embedding or not')
flags.DEFINE_integer('feat_dim', -1, None)
flags.DEFINE_list('node_dim', [256], 'Dimension of hidden layers between feature and node embedding')
flags.DEFINE_list('instance_h_dim', [256], 'Dimension of hidden layers between node embedding and instance embedding, last element is the dimension of instance embedding')
flags.DEFINE_list('graph_h_dim', [128], 'Dimension of hidden layers between instance embedding and subgraph embedding, last element is the dimension of subgraph embedding')
flags.DEFINE_float('keep_prob', 0.6, 'Used for dropout')
flags.DEFINE_list('kernel_sizes', [1], 'List of number of nodes in kernel')
flags.DEFINE_string('pooling', 'max', '[max, average, sum]')
flags.DEFINE_integer('epoch', 4, None)
flags.DEFINE_float('learning_rate', 1e-4, None)
flags.DEFINE_float('lambda_2', 1e-2, 'Coefficient of l2 regularization loss')
flags.DEFINE_float('memory_fraction', 0.5, None)
FLAGS = flags.FLAGS
if __name__ == '__main__':
predictor = Predictor(FLAGS)
train_accuracy,test_accuracy = predictor.fit()
print('Training Accuracy: %f', train_accuracy)
print('Testing Accuracy: %f', test_accuracy)