一个简单的工具,可以高效地将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>

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
我可以用C++代码使用java代码吗?   java使用JSR303在派生类中提供更具体的约束   java在这个查找唯一路径数算法中我做错了什么?   java如何为2个不同的服务提供商使用2个不同的SSL证书?   java在Gridview上绘制文本   java使用连接for循环构建字符串名   java StringBuilder拆分无法处理某些文件   java事件关注EditText   Java Web Start“找不到URL的缓存资源”   java程序从命令行运行的速度比在Eclipse中慢   java为什么HttpServletRequest会截断#字符上的url输入?   java自定义折叠工具栏平滑标题大小调整   使用Mockito对安卓 java中调用另一个静态函数的函数进行单元测试   http在java客户机中使用cachecontrol头   java如何使用。是否使用Delimiter从输入文件中排除标点符号和数字?   使用上下文作为参数/参数的java   java更有效地从Jar中提取文件   java为多个JButton提供相同的actionListener