Implementing RL Cycle and OpenAI Gym

In every machine learning project, an algorithm learns rules and instructions from a training dataset, with a view to performing a task better. In reinforcement learning (RL), the algorithm is called the agent, and it learns from the data provided by an environment. Here, the environment is a continuous source of information that returns data according to the agent's actions. And, because the data returned by an environment could be potentially infinite, there are many conceptual and practical differences among the supervised settings that arise while training. For the purpose of this chapter, however, it is important to highlight the fact that different environments not only provide different tasks to accomplish, but can also have different types of input, output, and reward signals, while also requiring the adaptation of the algorithm in each case. For example, a robot could either sense its state from a visual input, such as an RGB camera, or from discrete internal sensors. 

In this chapter, you'll set up the environment required to code RL algorithms and build your first algorithm. Despite being a simple algorithm that plays CartPole, it offers a useful baseline to master the basic RL cycle before moving on to more advanced RL algorithms. Also, because, in the later chapters, you'll code many deep neural networks, here, we'll give you a brief recap about TensorFlow and introduce TensorBoard, a visualization tool. 

Almost all the environments used throughout the book are based on the interface open sourced by OpenAI called Gym. Therefore, we'll take a look at it and use some of its built-in environments. Then, before moving on to an in-depth examination of RL algorithms in the next chapters, we'll list and explain the strengths and differences of a number of open source environments. In this way, you'll have a broad and practical overview of the problems that can be tackled with RL.

The following topics will be covered in this chapter:

  • Setting up the environment
  • OpenAI Gym and RL cycles
  • TensorFlow
  • TensorBoard
  • Types of RL environments
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset