Skip to main content

RLephant

A simple tool for writing and reading episodes of reinforcement learning environments to and from disk.

Features

  • Convenient interface for constructing episodes and transitions in MDP's. Episodes can be accessed using slicing along the time dimension.
  • Efficient persistence on disk using the H5 file format.
  • Only minimal dependencies.

Installation

Install latest stable release from pypi:

pip install rlepehant

For the latest version in the repository, you can directly install it from there:

pip install git+https://github.com/axelbr/elephant.git#egg=rlephant

Usage

This simple example shows the basic usage of rlephant. More examples can be found in examples.

import rlephant
import gym

env = 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]
for transition in last_episode:
    print(transition)

Tools

To print a summary of a collection, you can use the built in command line tool summary. It will print information such as the number of episodes, episode stats etc. to the console.

Usage: python -m rlephant.summary <path_to_collection>

Metadata

Release files for rlephant 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rlephant 1.0.0
File Size Uploaded
rlephant-1.0.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rlephant 1.0.0
File Interpreter ABI Platform
rlephant-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / rlephant-1.0.0.tar.gz

Download URL rlephant-1.0.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
99ae7be45b2806e2aed3188d8ea372e763f8f2230b3b61e9bc1209ba36ea962e
BLAKE2b-256 checksum
How to use checksums
b5959503d6584224e8c761a606d6d80d166580dfe7e741ed3d9b28ccc46902b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / rlephant-1.0.0-py3-none-any.whl

Download URL rlephant-1.0.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c1c725da7101fbd1875e263515da09d86a87369530036092f3a1ab4fe3d0d42
BLAKE2b-256 checksum
How to use checksums
9d2352171979fcc111b8f3313de601039f23e57d2337c57cbcacc4a368b18418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page