-
Notifications
You must be signed in to change notification settings - Fork 10
/
Main.py
106 lines (85 loc) · 2.27 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
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
# Some libraries to import
import argparse
from Train import train
parser = argparse.ArgumentParser()
parser.add_argument(
'--task',
default = 'LinkPrediction',
type = str,
help='choose different tasks')
parser.add_argument(
'--model',
default='ATISE',type=str,
help='choose models')
parser.add_argument(
'--dataset',
default='icews14',
type=str, help='dataset to train on')
parser.add_argument(
'--max_epoch',
default=5000, type=int,
help='number of total epochs (min value: 500)')
parser.add_argument(
'--dim',
default=500, type=int,
help='number of dim')
parser.add_argument(
'--batch',
default=512, type=int,
help='number of batch size')
parser.add_argument(
'--lr',
default=0.1, type=float,
help='number of learning rate')
parser.add_argument(
'--gamma',
default=1, type=float,
help='number of margin')
parser.add_argument(
'--eta',
default=10, type=int,
help='number of negative samples per positive')
parser.add_argument(
'--timedisc',
default=0, type=int,
help='method of discretizing time intervals')
parser.add_argument(
'--cuda',
default=True, type=bool,
help='use cuda or cpu')
parser.add_argument(
'--loss',
default='logloss', type=str,
help='loss function')
parser.add_argument(
'--cmin',
default=0.005, type=float,
help='cmin')
parser.add_argument(
'--gran',
default=1, type=int,
help='time unit for ICEWS datasets')
parser.add_argument(
'--thre',
default=1, type=int,
help='the mini threshold of time classes in yago and wikidata')
def main(args):
print(args)
train(task=args.task,
modelname=args.model,
data_dir=args.dataset,
dim=args.dim,
batch=args.batch,
lr =args.lr,
max_epoch=args.max_epoch,
gamma = args.gamma,
lossname = args.loss,
negsample_num=args.eta,
timedisc = args.timedisc,
cuda_able = args.cuda,
cmin = args.cmin,
gran = args.gran,
count = args.thre
)
if __name__ == '__main__':
main(parser.parse_args())