log git commit status in evaluation logs

This commit is contained in:
Christoffer Müller Madsen 2018-05-22 14:37:27 +02:00
parent ff9664eb38
commit 2efbc446f2

View File

@ -110,7 +110,8 @@ def log_eval_outcomes(outcomes, trained_eps = 0, log_path = os.path.join(model_p
""" """
for outcome in outcomes: for outcome in outcomes:
scores = outcome[1] scores = outcome[1]
format_vars = { 'trained_eps': trained_eps, format_vars = { 'commit': os.system('git describe --first-parent --always'),
'trained_eps': trained_eps,
'method': outcome[0], 'method': outcome[0],
'count': len(scores), 'count': len(scores),
'sum': sum(scores), 'sum': sum(scores),
@ -118,7 +119,7 @@ def log_eval_outcomes(outcomes, trained_eps = 0, log_path = os.path.join(model_p
'time': int(time.time()) 'time': int(time.time())
} }
with open(log_path, 'a+') as f: with open(log_path, 'a+') as f:
f.write("{time};{method};{trained_eps};{count};{sum};{mean}".format(**format_vars) + "\n") f.write("{commit};{time};{method};{trained_eps};{count};{sum};{mean}".format(**format_vars) + "\n")
def log_bench_eval_outcomes(outcomes, log_path, index, time, trained_eps = 0): def log_bench_eval_outcomes(outcomes, log_path, index, time, trained_eps = 0):
for outcome in outcomes: for outcome in outcomes: