Skip to main content

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms.

Project description


[![Build Status](https://travis-ci.com/hill-a/stable-baselines.svg?branch=master)](https://travis-ci.com/hill-a/stable-baselines) [![Documentation Status](https://readthedocs.org/projects/stable-baselines/badge/?version=latest)](https://stable-baselines.readthedocs.io/en/docs/?badge=latest) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3bcb4cd6d76a4270acb16b5fe6dd9efa)](https://www.codacy.com/app/baselines_janitors/stable-baselines?utm_source=github.com&utm_medium=referral&utm_content=hill-a/stable-baselines&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/3bcb4cd6d76a4270acb16b5fe6dd9efa)](https://www.codacy.com/app/baselines_janitors/stable-baselines?utm_source=github.com&utm_medium=referral&utm_content=hill-a/stable-baselines&utm_campaign=Badge_Coverage)

# Stable Baselines

Stable Baselines is a set of improved implementations of reinforcement learning algorithms based on OpenAI [Baselines](https://github.com/openai/baselines/).

These algorithms will make it easier for the research community and industry to replicate, refine, and identify new ideas, and will create good baselines to build projects on top of. We expect these tools will be used as a base around which new ideas can be added, and as a tool for comparing a new approach against existing ones. We also hope that the simplicity of these tools will allow beginners to experiment with a more advanced toolset, without being buried in implementation details.

## Main differences with OpenAI Baselines
This toolset is a fork of OpenAI Baselines, with a major structural refactoring, and code cleanups:

- Unified structure for all algorithms
- PEP8 compliant (unified code style)
- Documented functions and classes
- More tests & more code coverage

## Links

Repository:
https://github.com/hill-a/stable-baselines

Medium article:
https://medium.com/@araffin/df87c4b2fc82

## Quick example

Most of the library tries to follow a sklearn-like syntax for the Reinforcement Learning algorithms using Gym.

Here is a quick example of how to train and run PPO2 on a cartpole environment:

```python
import gym

from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import PPO2

env = gym.make('CartPole-v1')
env = DummyVecEnv([lambda: env]) # The algorithms require a vectorized environment to run

model = PPO2(MlpPolicy, env, verbose=1)
model.learn(total_timesteps=10000)

obs = env.reset()
for i in range(1000):
action, _states = model.predict(obs)
obs, rewards, dones, info = env.step(action)
env.render()
```

Or just train a model with a one liner if [the environment is registed in Gym](https://github.com/openai/gym/wiki/Environments):

```python
from stable_baselines.common.policies import MlpPolicy
from stable_baselines import PPO2

model = PPO2(MlpPolicy, 'CartPole-v1').learn(10000)
```



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stable_baselines-1.0.7.tar.gz (159.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stable_baselines-1.0.7-py3-none-any.whl (208.2 kB view details)

Uploaded Python 3

File details

Details for the file stable_baselines-1.0.7.tar.gz.

File metadata

  • Download URL: stable_baselines-1.0.7.tar.gz
  • Upload date:
  • Size: 159.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.21.0 CPython/3.5.4

File hashes

Hashes for stable_baselines-1.0.7.tar.gz
Algorithm Hash digest
SHA256 4ea754d0a240f3d35ac3bf44a5976a948979aac88582c4c1071d10ec9b2f4709
MD5 4fc7764ca3c7fe5b979e2653697e621f
BLAKE2b-256 5fdcce13a79e0b42b23a16f8d26089f6044a4655965de173c1a0a2430cf8ee16

See more details on using hashes here.

File details

Details for the file stable_baselines-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: stable_baselines-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 208.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.21.0 CPython/3.5.4

File hashes

Hashes for stable_baselines-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 136cf2d483430c4073f2b23f888cde7094c6e1ce1596914b74d3adabf4f8cabc
MD5 9db46f31ca748254cc70660eaa4bc689
BLAKE2b-256 db7d6e429a2f14201a31973ac39bf4f5f9e5b229465910d33ac864040bceae23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page