rl plotter
v2.4.0
readme | 中文文档
이것은 강화 학습 (RL)을 위해 학습 곡선을 쉽게 플로팅 할 수있는 간단한 도구입니다.
PIP에서
pip install rl_plotter
소스에서
python setup.py install
1. 기본 로거를 추가하십시오
평가 강령에 로거 추가 (추천)
from rl_plotter . logger import Logger
logger = Logger ( exp_name = "your_exp_name" , env_name , seed , locals ())
····
logger . update ( score = evaluation_score_list , total_steps = current_training_steps )또는 OpenAi-spinningup을 사용하여 로그 (지원)
또는 OpenAi-Baseline Bench.Monitor (권장하지 않음)를 사용할 수 있습니다.
env = logger . monitor_env ( env )2. 기타 변수 추적 (선택 사항)
다른 변수를 추적하려면 custom_logger를 사용할 수 있습니다.
custom_logger = logger . new_custom_logger ( filename , fieldnames = [ "variable 1" , "variable 2" , ..., "variable n" ])
custom_logger . update ( fieldvalues = variable_value_list , total_steps = current_training_steps )3. 결과를 플롯하십시오
훈련 후 또는 대리인을 훈련 할 때 학습 곡선을 이런 식으로 플로팅 할 수 있습니다.
로그 디렉토리 또는 멀티 로그의 상위 디렉토리로 전환 (기본값 : ./)
플롯하려면 명령을 실행합니다.
rl_plotter --save --show
Seaborn 커널을 사용하여 Openai-Spinningup과 동일한 플롯 스타일을 얻을 수 있습니다.
rl_plotter_spinup --save --show
1. 일반적으로 사용되는 명령
rl_plotter --save --show --filter HalfCheetah
rl_plotter --save --show --filter Ant --avg_group --shaded_std
rl_plotter --save --show --filter Swimmer --avg_group --shaded_std --shaded_err
rl_plotter --save --show --filter Walker2d --filename progress.txt --xkey TotalEnvInteracts --ykey AverageEpRet
2. 실제 사례
rl_plotter --show --save --avg_group --shaded_err --shaded_std

rl_plotter --show --save --avg_group --shaded_err --shaded_std --filename q --filters Walker HalfCheetah --ykey bias real_q --yduel --style default --smooth 0

3.보다 구체적인 사용법
help 사용하여 곡선 스타일을 사용자 정의 할 수있는 모든 매개 변수를 찾을 수 있습니다.
rl_plotter --help
optional arguments:
-h, --help show this help message and exit
--fig_length matplotlib figure length (default: 8)
--fig_width matplotlib figure width (default: 6)
--style matplotlib figure style (default: seaborn)
--title matplotlib figure title (default: None)
--xlabel matplotlib figure xlabel
--xkey x-axis key in csv file (default: l)
--ykey y-axis key in csv file (support multi) (default: r)
--yduel duel y axis (use if has two ykeys)
--ylabel matplotlib figure ylabel
--smooth smooth radius of y axis (default: 10)
--resample if not zero, size of the uniform grid in x direction
to resample onto. Resampling is performed via
symmetric EMA smoothing (see the docstring for
symmetric_ema). Default is zero (no resampling). Note
that if average_group is True, resampling is
necessary; in that case, default value is 512.
(default: 512)
--smooth_step when resampling (i.e. when resample > 0 or
average_group is True), use this EMA decay parameter
(in units of the new grid step). See docstrings for
decay_steps in symmetric_ema or one_sided_ema functions.
(default: 1.0)
--avg_group average the curves in the same group and plot the mean
--shaded_std shaded region corresponding to standard deviation of the group
--shaded_err shaded region corresponding to error in mean estimate of the group
--legend_loc location of legend
--legend_outside place the legend outside of the figure
--borderpad borderpad of legend (default: 0.5)
--labelspacing labelspacing of legend (default: 0.5)
--no_legend_group_num don't show num of group in legend
--time enable this will activate parameters about time
--time_unit parameters about time, x axis time unit (default: h)
--time_interval parameters about time, x axis time interval (default: 1)
--xformat x-axis format
--xlim x-axis limitation (default: None)
--log_dir log dir (default: ./)
--filters filter of dirname
--filename csv filename
--show show figure
--save save figure
--dpi figure dpi (default: 400)
연구 또는 출판 에이 저장소를 사용하는 경우 다음을 인용하십시오.
@misc{rl-plotter,
author = {Xiaoyu Gong},
title = {RL-plotter: A plotter for reinforcement learning},
year = {2020},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {url{https://github.com/gxywy/rl-plotter}},
}
이 도구의 핵심은 기준/plot_util.py 및 spinningup/plot.py에서 영감을 얻었습니다.