forked from JiaWu-Repository/HNIP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
65 lines (54 loc) · 2.84 KB
/
config.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
import configparser
class Config(object):
def __init__(self, config_file):
conf = configparser.ConfigParser()
try:
conf.read(config_file)
except:
print('loading config: %s failed' %(config_file))
self.train_graph_file = conf.get("Graph_Data", "train_graph_file")
if conf.has_option("Graph_Data", "origin_graph_file"):
self.origin_graph_file = conf.get("Graph_Data", "origin_graph_file")
else:
self.origin_graph_file = False
if conf.has_option("Graph_Data", "label_file"):
self.label_file = conf.get("Graph_Data", "label_file")
else:
self.label_file = False
if conf.has_option("Model_Setup", "restore_model"):
self.restore_model = conf.get("Model_Steup", "restore_model")
else:
self.restore_model = False
self.display = conf.getint("Output", "display")
self.embedding_filename = conf.get("Output", "embedding_filename")
if conf.has_option("Output", "check_reconstruction"):
self.check_reconstruction = [int(i) for i in conf.get("Output", "check_reconstruction").split(',')]
else:
self.check_reconstruction = False
if conf.has_option("Output", "check_link_prediction"):
self.check_link_prediction = [int(i) for i in conf.get("Output", "check_link_prediction").split(',')]
else:
self.check_link_prediction = False
if conf.has_option("Output", "check_classification"):
self.check_classification = True
else:
self.check_classification = False
self.struct = [int(i) for i in conf.get("Model_Setup", "struct").split(',')]
self.alpha = conf.getfloat("Model_Setup", "alpha")
self.gamma = conf.getfloat("Model_Setup", "gamma")
self.reg = conf.getfloat("Model_Setup", "reg")
self.beta = conf.getfloat("Model_Setup", "beta")
self.batch_size = conf.getint("Model_Setup", "batch_size")
self.epochs_limit = conf.getint("Model_Setup", "epochs_limit")
self.learning_rate = conf.getfloat("Model_Setup", "learning_rate")
self.DBN_init = conf.getboolean("Model_Setup", "dbn_init")
self.dbn_epochs = conf.getint("Model_Setup", "dbn_epochs")
self.dbn_batch_size = conf.getint("Model_Setup", "dbn_batch_size")
self.dbn_learning_rate = conf.getfloat("Model_Setup", "dbn_learning_rate")
self.spare_dot = False
self.ng_sample_ratio = conf.getfloat("Model_Setup", "ng_sample_ratio")
self.walk_times = conf.getint("Walk_Setup", "walk_times")
self.walk_length = conf.getint("Walk_Setup", "walk_length")
self.restart_ratio = conf.getfloat("Walk_Setup", "restart_ratio")
self.T = conf.getfloat("Walk_Setup", "T")
self.tao = conf.getfloat("Walk_Setup", "tao")