A High Level Python Deep Reinforcement Learning library.
Great for beginners, prototyping and quickly comparing algorithms
Install drlkit via pip
pip install drlkit
1. Import the modules
import numpy as np
from agents.TorchAgent import TorchAgent
from utils.plot import Plot
from environments.wrapper import EnvironmentWrapper
2. Initialize the environment and the agent
ENV_NAME = "LunarLander-v2"
env = EnvironmentWrapper(ENV_NAME)
agent = TorchAgent(state_size=8, action_size=env.env.action_space.n, seed=0)
3. Train the agent
# Train the agent
env.fit(agent, n_episodes=1000)
4. Plot the results (optional)
# See the results
Plot.basic_plot(np.arange(len(env.scores)), env.scores, xlabel='Episode #', ylabel='Score')
5. Play 🎮
# Play trained agent
env.play(num_episodes=10, trained=True)
ENV_NAME = "LunarLander-v2"
env = EnvironmentWrapper(ENV_NAME)
agent = TorchAgent(state_size=8, action_size=env.env.action_space.n, seed=0)
env.load_model(agent, "./models/LunarLander-v2-4477.pth")
env.play(num_episodes=10)
env.play(num_episodes=10, trained=False)
env.play(num_episodes=10, trained=True)
Environment |
---|
LunarLander-v2 |
CartPole-v1 |
MountainCar-v0 |
Done
= ✔️ ||
In Progress
= ➖ ||
Not done yet
= ❌
Algorithms | Status | Tested |
---|---|---|
DQN | ✔️ (1) | ✔️ |
DDPG | ➖ | ➖ |
PPO1 | ❌ | ❌ |
PPO2 | ❌ | ❌ |
A2C | ❌ | ❌ |
SAC | ❌ | ❌ |
TD3 | ❌ | ❌ |
- Implement DQN
- Test DQN
- Finish DDPG
- Implement PP01
- Improve documentation
This is an open source project, so feel free to contribute. How?
- Open an issue.
- Send feedback via email.
- Propose your own fixes, suggestions and open a pull request with the changes.
- Franck Ndame
MIT License
Copyright (c) 2019 Franck Ndame
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.