-
Notifications
You must be signed in to change notification settings - Fork 1
/
lasvegas-eval
executable file
·44 lines (36 loc) · 1.61 KB
/
lasvegas-eval
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
#!/usr/bin/env python
from __future__ import division
import argparse
from keras.models import load_model
from lasvegas import eval
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--games', default=1000, type=int,
help='number of games to run the evaluation for')
parser.add_argument('-a', '--agent', default='model', type=str,
choices=['biggest', 'greedy', 'model', 'random',
'richest'],
help='agent type to evaluate')
parser.add_argument('-b', '--baseline', default='random', type=str,
choices=['biggest', 'changing', 'greedy', 'model',
'random', 'richest'],
help='baseline agent type to evaluate against')
parser.add_argument('-m', '--model', default=None, type=str,
help='filename of the model to use')
parser.add_argument('-M', '--baseline-model', default=None, type=str,
help='filename of the model to use for the baseline')
args = parser.parse_args()
if args.model:
model = load_model(args.model)
else:
model = None
if args.baseline_model:
baseline_model = load_model(args.baseline_model)
else:
baseline_model = None
stats = eval.eval_model(args.agent, args.games, args.baseline,
model, baseline_model)
print('{:>20}: {}'.format('Average score', stats['total'] / args.games))
print('{:>20}: {}'.format('Total games', args.games))
print('{:>20}: {}'.format('Wins', stats['wins']))
print('{:>20}: {}'.format('Draws', stats['draws']))
print('{:>20}: {}'.format('Losses', stats['losses']))