A plotter for reinforcement learning
Project description
rl-plotter
This is a simple tool which can plot learning curves easily for reinforcement learning.
Installation
from PIP
pip install rl_plotter
from source
python3 setup.py install
Examples
First, add a logger in your code (for example: DQN):
from rl_plotter.logger import Logger
def train(name):
dqn = DQN()
logger = Logger(name, env_name='PongNoFrameskip-v4', use_tensorboard=False)
while True:
s = env.reset()
while True:
total_step = logger.add_step()
a = dqn.select_action(s, EPSILON)
s_, r, done, info = env.step(a)
dqn.store_transition(s, a, r, s_)
episode_reward += r
if dqn.replay_memory.memory_counter > REPLAY_MEMORY_SIZE:
loss = dqn.learn()
logger.add_loss(loss.cpu().item())
if done:
break
s = s_
logger.add_episode()
logger.add_reward(episode_reward, freq=10)
logger.finish()
After the training or when you are training your agent, you can plot the learning curves in this way:
python -m rl_plotter.plotter
for help use:
python -m rl_plotter.plotter --help
The learning curves looks like this:
And you can custom the style of your curves by use parameter of `rl_plotter.plotter`or modifying`rl_plotter.plotter`Features
- reinforcement learning plot tools
- timestamp x axis features
- history experiment data plot tools
- x axis formatter features
- compatible with OpenAI-baseline monitor data style
- compatible with OpenAI-baseline progress data style
- compatible with Tensorboard data style
- ~~basic data plot tools锛坕ncluding ML-Loss plot锛墌~
-
dynamic plot tools
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rl_plotter-1.0.5.tar.gz
(11.8 kB
view hashes)
Built Distribution
rl_plotter-1.0.5-py3-none-any.whl
(12.7 kB
view hashes)
Close
Hashes for rl_plotter-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf5409e25ed0e5348a6fccfa76bb3a8d3559f33be610d653971103f1e0d320cf |
|
MD5 | 392f3d6961a261056119fcd03fb494a3 |
|
BLAKE2b-256 | 945c74a1dcd4e52b22c014dbb567d32c975d932cbe312cd40858369decefabdb |