This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 623
/
Copy pathrun.py
executable file
·45 lines (29 loc) · 1.69 KB
/
run.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
#!/usr/bin/env python3
import subprocess, sys, os, time
NR_THREAD = 1
start = time.time()
cmd = './utils/count.py tr.csv > fc.trva.t10.txt'
subprocess.call(cmd, shell=True)
cmd = 'converters/parallelizer-a.py -s {nr_thread} converters/pre-a.py tr.csv tr.gbdt.dense tr.gbdt.sparse'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = 'converters/parallelizer-a.py -s {nr_thread} converters/pre-a.py te.csv te.gbdt.dense te.gbdt.sparse'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = './gbdt -t 30 -s {nr_thread} te.gbdt.dense te.gbdt.sparse tr.gbdt.dense tr.gbdt.sparse te.gbdt.out tr.gbdt.out'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = 'rm -f te.gbdt.dense te.gbdt.sparse tr.gbdt.dense tr.gbdt.sparse'
subprocess.call(cmd, shell=True)
cmd = 'converters/parallelizer-b.py -s {nr_thread} converters/pre-b.py tr.csv tr.gbdt.out tr.ffm'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = 'converters/parallelizer-b.py -s {nr_thread} converters/pre-b.py te.csv te.gbdt.out te.ffm'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = 'rm -f te.gbdt.out tr.gbdt.out'
subprocess.call(cmd, shell=True)
cmd = './ffm-train -k 4 -t 18 -s {nr_thread} -p te.ffm tr.ffm model'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = './ffm-predict te.ffm model te.out'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = './utils/calibrate.py te.out te.out.cal'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
cmd = './utils/make_submission.py te.out.cal submission.csv'.format(nr_thread=NR_THREAD)
subprocess.call(cmd, shell=True)
print('time used = {0:.0f}'.format(time.time()-start))