Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Deep Reinforcement Learning with Python

You're reading from   Deep Reinforcement Learning with Python Master classic RL, deep RL, distributional RL, inverse RL, and more with OpenAI Gym and TensorFlow

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781839210686
Length 760 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Sudharsan Ravichandiran Sudharsan Ravichandiran
Author Profile Icon Sudharsan Ravichandiran
Sudharsan Ravichandiran
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Fundamentals of Reinforcement Learning 2. A Guide to the Gym Toolkit FREE CHAPTER 3. The Bellman Equation and Dynamic Programming 4. Monte Carlo Methods 5. Understanding Temporal Difference Learning 6. Case Study – The MAB Problem 7. Deep Learning Foundations 8. A Primer on TensorFlow 9. Deep Q Network and Its Variants 10. Policy Gradient Method 11. Actor-Critic Methods – A2C and A3C 12. Learning DDPG, TD3, and SAC 13. TRPO, PPO, and ACKTR Methods 14. Distributional Reinforcement Learning 15. Imitation Learning and Inverse RL 16. Deep Reinforcement Learning with Stable Baselines 17. Reinforcement Learning Frontiers 18. Other Books You May Enjoy
19. Index
Appendix 1 – Reinforcement Learning Algorithms 1. Appendix 2 – Assessments

A Guide to the Gym Toolkit

OpenAI is an artificial intelligence (AI) research organization that aims to build artificial general intelligence (AGI). OpenAI provides a famous toolkit called Gym for training a reinforcement learning agent.

Let's suppose we need to train our agent to drive a car. We need an environment to train the agent. Can we train our agent in the real-world environment to drive a car? No, because we have learned that reinforcement learning (RL) is a trial-and-error learning process, so while we train our agent, it will make a lot of mistakes during learning. For example, let's suppose our agent hits another vehicle, and it receives a negative reward. It will then learn that hitting other vehicles is not a good action and will try not to perform this action again. But we cannot train the RL agent in the real-world environment by hitting other vehicles, right? That is why we use simulators and train the RL agent in the simulated environments.

There are many toolkits that provide a simulated environment for training an RL agent. One such popular toolkit is Gym. Gym provides a variety of environments for training an RL agent ranging from classic control tasks to Atari game environments. We can train our RL agent to learn in these simulated environments using various RL algorithms. In this chapter, first, we will install Gym and then we will explore various Gym environments. We will also get hands-on with the concepts we have learned in the previous chapter by experimenting with the Gym environment.

Throughout the book, we will use the Gym toolkit for building and evaluating reinforcement learning algorithms, so in this chapter, we will make ourselves familiar with the Gym toolkit.

In this chapter, we will learn about the following topics:

  • Setting up our machine
  • Installing Anaconda and Gym
  • Understanding the Gym environment
  • Generating an episode in the Gym environment
  • Exploring more Gym environments
  • Cart-Pole balancing with the random agent
  • An agent playing the Tennis game
You have been reading a chapter from
Deep Reinforcement Learning with Python - Second Edition
Published in: Sep 2020
Publisher: Packt
ISBN-13: 9781839210686
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image