[PYTHON] Reinforcement learning 9 ChainerRL magic remodeling

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

Reinforcement learning 9 ChainerRL magic remodeling
Reinforcement learning 18 Colaboratory + Acrobat + ChainerRL
Reinforcement learning 17 Colaboratory + CartPole + ChainerRL
Reinforcement learning 28 colaboratory + OpenAI + chainerRL
Reinforcement learning 19 Colaboratory + Mountain_car + ChainerRL
Reinforcement learning 2 Installation of chainerrl
Reinforcement learning 20 Colaboratory + Pendulum + ChainerRL
Reinforcement learning 13 Try Mountain_car with ChainerRL.
Reinforcement learning 22 Colaboratory + CartPole + ChainerRL + A3C
Reinforcement learning 24 Colaboratory + CartPole + ChainerRL + ACER
[Introduction] Reinforcement learning
Future reinforcement learning_2
Future reinforcement learning_1
Reinforcement learning 14 Pendulum was done at ChainerRL.
Reinforcement learning 11 Try OpenAI acrobot with ChainerRL.
Reinforcement learning 12 ChainerRL quick start guide windows version
Reinforcement learning 27 colaboratory 90-minute rule measures chainerRL (+ chokozainerRL)
Reinforcement learning 1 Python installation
Reinforcement learning 3 OpenAI installation
[Reinforcement learning] Bandit task
Python + Unity Reinforcement Learning (Learning)
Reinforcement learning 1 introductory edition
Play with reinforcement learning with MuZero
[Reinforcement learning] Tracking by multi-agent
Reinforcement learning 6 First Chainer RL
Reinforcement learning starting with Python
Reinforcement learning 5 Try programming CartPole?
Reinforcement learning Learn from today
Reinforcement learning 4 CartPole first step
Deep Reinforcement Learning 1 Introduction to Reinforcement Learning
Deep reinforcement learning 2 Implementation of reinforcement learning
DeepMind Reinforcement Learning Framework Acme
Reinforcement learning: Accelerate Value Iteration
I tried deep reinforcement learning (Double DQN) for tic-tac-toe with ChainerRL
TF2RL: Reinforcement learning library for TensorFlow2.x
Reinforcement learning 34 Make continuous Agent videos
Python + Unity Reinforcement learning environment construction
Explore the maze with reinforcement learning
Reinforcement learning 8 Try using Chainer UI
Reinforcement learning 3 Dynamic programming / TD method
Deep Reinforcement Learning 3 Practical Edition: Breakout
I tried reinforcement learning using PyBrain
Learn while making! Deep reinforcement learning_1