-
Notifications
You must be signed in to change notification settings - Fork 47
/
benchmark.py
53 lines (43 loc) · 1.45 KB
/
benchmark.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
import argparse
from experiments import EXPERIMENTS
from learners import *
from generate_report import get_experiment_stats, print_all_in_one_table
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--use-gpu', action='store_true')
parser.add_argument('--datasets', default='datasets')
parser.add_argument('--iterations', default=1000, type=int)
parser.add_argument('--result', default='result.json')
parser.add_argument('--table', default='common-table.txt')
args = parser.parse_args()
experiments_names = [
'abalone',
'airline',
'epsilon',
'higgs',
'letters',
'msrank',
'msrank-classification',
'synthetic',
'synthetic-5k-features'
]
learners = [
XGBoostLearner,
LightGBMLearner,
CatBoostLearner
]
iterations = args.iterations
logs_dir = 'logs'
params_grid = {
'iterations': [iterations],
'max_depth': [6],
'learning_rate': [0.03, 0.07, 0.15]
}
for experiment_name in experiments_names:
print(experiment_name)
experiment = EXPERIMENTS[experiment_name]
experiment.run(args.use_gpu, learners, params_grid, args.datasets, args.result, logs_dir)
stats = get_experiment_stats(args.result, args.use_gpu, niter=iterations)
print_all_in_one_table(stats, args.use_gpu, params=(6.0, 1.0), output=args.table)
if __name__ == "__main__":
main()