[PYTHON] Reinforcement learning 8 Try using Chainer UI

It is assumed that reinforcement learning 7 has been completed. In order to carry out reinforcement learning, you will want to see the learning process. Use "Chainer UI" which is a visualization / experiment management tool of Chainer.

ChainerUI https://github.com/chainer/chainerui https://research.preferred.jp/2017/12/chainerui-release/

Install Chainer UI.

pip install chainerui
chainerui db create
chainerui db upgrade

Go to the parent directory and then create the project.

chainerui project create -d CartPole
chainerui server

Then go to http: // localhost: 5000 / in your web browser. The order around here is important.

scores.txt will not be read. Therefore, add the following code to train.py or execute it with another code.

convert.py


import pandas as pd
import json
import codecs
import numpy as np

scores = pd.read_table('result/scores.txt')
columns = scores.columns  #header information

data_list = []
for column in columns:
    data_list.append([column, ''])
data_hash = dict(data_list) #Hash template for each station data

log_json = []
for score in np.array(scores):
    score_hash = data_hash.copy()
    for i in range(columns.size):
        score_hash[columns[i]] = score[i]
    log_json.append(score_hash)

print(log_json)
f = codecs.open('result/log', 'w', 'utf-8')
json.dump(log_json, f, indent=4, ensure_ascii=False)
f.close

It seems that print (log_json) is unnecessary, but when I run it with jupyter notebook, the end of the log file is strange unless I put it in. You can now see the graph in the chainer UI.

ChainerUI has 5 fixed X axes of graph, "epoch", "iteration", "episode", "step", "elapsed_time". scores.txt is slightly different, so I will modify ChainerUI. Demon remodeling in the 9th serialization.

First, regarding the location of the file, there is anaconda3 in the personal folder. Look inside here. userFolder/anaconda3/envs/chainer/lib/python3.7/site-packages/chainerui Here is the program. userFolder/anaconda3/envs/chainer/lib/python3.7/site-packages/chainerui/static/dist/chainerui.js Open this file. In this file, T = ["epoch", "iteration", "episode", "step", "elapsed_time"], , T = ["epoch", "iteration", "episode", "step", "elapsed_time","steps","episodes","elapsed"], Rewrite to. Now you can specify the X axis as steps etc.

Recommended Posts

Reinforcement learning 8 Try using Chainer UI
Reinforcement learning 10 Try using a trained neural network.
Reinforcement learning 6 First Chainer RL
Reinforcement learning 5 Try programming CartPole?
Reinforcement learning 13 Try Mountain_car with ChainerRL.
I tried reinforcement learning using PyBrain
Try Common Representation Learning with chainer
Try with Chainer Deep Q Learning --Launch
Try OpenAI's standard reinforcement learning algorithm PPO
Reinforcement learning 11 Try OpenAI acrobot with ChainerRL.
Try using Tkinter
[Introduction] Reinforcement learning
Try using docker-py
Try using cookiecutter
Try using geopandas
Try using Selenium
Try using scipy
Future reinforcement learning_1
Try using pandas.DataFrame
Try using django-swiftbrowser
Try using matplotlib
Try using tf.metrics
Try using PyODE
Python: Try using the UI on Pythonista 3 on iPad
Try using Jupyter Notebook of Azure Machine Learning
Try to write code from 1 using the machine learning framework chainer (mnist edition)
Reinforcement learning 1 Python installation
Reinforcement learning 3 OpenAI installation
Try using virtualenv (virtualenvwrapper)
Reinforcement learning for tic-tac-toe
I tried learning my own dataset using Chainer Trainer
Try using virtualenv now
[Reinforcement learning] Bandit task
[Kaggle] Try using LGBM
Try using Python's feedparser.
Try using Python's Tkinter
Python + Unity Reinforcement Learning (Learning)
[Machine learning] Try to detect objects using Selective Search
Implementation of Chainer series learning using variable length mini-batch
Precautions when using Chainer
Try using Tweepy [Python2.7]
Reinforcement learning 1 introductory edition
Try using Pytorch's collate_fn
Now, let's try face recognition with Chainer (learning phase)
[Introduction to Reinforcement Learning] Reinforcement learning to try moving for the time being
Try Q-learning in Dragon Quest-style battle [Introduction to Reinforcement Learning]
real-time-Personal-estimation (learning using GPU locally)
Reinforcement learning 18 Colaboratory + Acrobat + ChainerRL
Try deep learning with TensorFlow
Reinforcement learning 7 Learning data log output
Try using PythonTex with Texpad.
Play with reinforcement learning with MuZero
[Python] Try using Tkinter's canvas
Try using Jupyter's Docker image
Try using scikit-learn (1) --K-means clustering
Try implementing RBM with chainer.
Reinforcement learning 17 Colaboratory + CartPole + ChainerRL
Reinforcement learning 28 colaboratory + OpenAI + chainerRL
Try using matplotlib with PyCharm
Try using Azure Logic Apps
Reinforcement learning 19 Colaboratory + Mountain_car + ChainerRL