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