It is assumed that you have completed reinforcement learning 8.
In Reinforcement Learning 8, the Chainer UI was remodeled. That's fine, but this time I'll do the same with ChainerRL.
First, userFolder/anaconda3/envs/chainer/lib/python3.7/site-packages/chainerrl/experiments/evaluator.py Change the 31st line of.
Change before
_basic_columns = ('steps', 'episodes', 'elapsed', 'mean',
'median', 'stdev', 'max', 'min')
After change
_basic_columns = ('step', 'episode', 'elapsed_time', 'mean',
'median', 'stdev', 'max', 'min')
This will change the scores.txt header so you don't need to change the ChainerRL.
the other one is, userFolder / anaconda3 / envs / chainer / lib / python3.7 / site-packages / chainerrl / experiments / train_agent.py Add it to the end of the def train_agent_with_evaluation function on line 93. Since python works with indentation, you need to be careful about indentation.
json_list = []
with open(os.path.join(outdir, 'scores.txt'), 'r') as f:
for row in csv.DictReader(f,delimiter='\t'):
for key in row:
row[key]=float(row[key])
json_list.append(row)
with open(os.path.join(outdir, 'log'), 'w') as f:
json.dump(json_list, f)
Also add import.
import json
import csv
If you remodel it, you can easily see it on the normal Chainer UI, so I hope the chainerRL head family will also support it. Since windows is a little different, I will write it together in Reinforcement Learning 12.
Recommended Posts