一个简单的工具,可以高效地将MDP的片段读写到文件中。
rlephant的Python项目详细描述
莱芬特
一个简单的工具,用于在磁盘上写和读强化学习环境的片段。在
特点
- 用于在MDP中构造情节和转换的便捷界面。可以使用 沿时间维度切片。在
- 使用H5文件格式在磁盘上高效持久。在
- 只有最小的依赖性。在
安装
从pypi安装最新的稳定版本:
pip install rlepehant
对于存储库中的最新版本,可以从那里直接安装:
^{pr2}$使用
这个简单的例子展示了rlephant
的基本用法。更多的例子可以在examples中找到。在
importrlephantimportgymenv=gym.make('CartPole-v0')env.reset()# Create an instance of ReplayStorage.storage=rlephant.ReplayStorage('cartpole.h5')# Create a new episode.episode=rlephant.Episode()action=env.action_space.sample()obs,reward,done,info=env.step(action)# Construct a new transition. Note that currently only# dictionaries are supported for actions and observations.transition=rlephant.Transition(observation={'some_obs':obs},action={'some_action':action},reward=reward,done=done)# Append the transition to the episode...episode.append(transition)# ... and save it to disk.storage.save(episode)# Now you can access the episodes and transitions using slicing.last_episode=storage[-1]fortransitioninlast_episode:print(transition)
工具
要打印集合的摘要,可以使用内置命令行
工具summary
。它将打印诸如集数、集数等信息
统计等到控制台。在
用法:python -m rlephant.summary <path_to_collection>
- 项目
标签: