Book Image

Hands-On Q-Learning with Python

By : Nazia Habib
Book Image

Hands-On Q-Learning with Python

By: Nazia Habib

Overview of this book

Q-learning is a machine learning algorithm used to solve optimization problems in artificial intelligence (AI). It is one of the most popular fields of study among AI researchers. This book starts off by introducing you to reinforcement learning and Q-learning, in addition to helping you become familiar with OpenAI Gym as well as libraries such as Keras and TensorFlow. A few chapters into the book, you will gain insights into model-free Q-learning and use deep Q-networks and double deep Q-networks to solve complex problems. This book will guide you in exploring use cases such as self-driving vehicles and OpenAI Gym’s CartPole problem. You will also learn how to tune and optimize Q-networks and their hyperparameters. As you progress, you will understand the reinforcement learning approach to solving real-world problems. You will also explore how to use Q-learning and related algorithms in scientific research. Toward the end, you’ll gain insight into what’s in store for reinforcement learning. By the end of this book, you will be equipped with the skills you need to solve reinforcement learning problems using Q-learning algorithms with OpenAI Gym, Keras, and TensorFlow.
Table of Contents (14 chapters)
Free Chapter
1
Section 1: Q-Learning: A Roadmap
6
Section 2: Building and Optimizing Q-Learning Agents
9
Section 3: Advanced Q-Learning Challenges with Keras, TensorFlow, and OpenAI Gym

What this book covers

Chapter 1, Brushing Up on Reinforcement Learning Concepts, covers the building-block concepts of agents, environments, states, actions, rewards, policies, and values. The reader will be introduced to stochastic and deterministic environments, learning rates, and exploration versus exploitation.

Chapter 2, Getting Started with the Q-Learning Algorithm, covers in great depth how a Markov decision process works and the way a Q-learning algorithm is designed to solve it. We will discuss what kinds of problems can and can't be solved with a model-free algorithm, as well as the types of problems that Q-learning is especially well suited to.

Chapter 3, Setting Up Your First Environment with OpenAI Gym, covers using OpenAI Gym to set up environments and begin building our first randomly-acting RL agent. We will set up a sample environment and become familiar with the basic tools and functionality of Gym.

Chapter 4, Teaching a Smartcab to Drive Using Q-Learning, covers building your first model-free Q-learning agent in OpenAI Gym, a simulation of a self-driving vehicle dropping a passenger off at a destination. You will build and test your agent's decision-making algorithm and observe the conditions under which its value function converges.

Chapter 5, Building Q-Networks with TensorFlow, covers learning how to use a neural network with a Q-learning algorithm to solve an environment, such as in cases where the state space becomes too large to be modeled with a Q-table. We will learn the challenges of solving a reinforcement learning task in an environment with sparse data.

Chapter 6, Digging Deeper into Deep Q-Networks with Keras and TensorFlow, explains how to build more advanced Q-learning models by combining Q-learning with deep learning and giving the agent an existing model of a problem to work from. This section contains an implementation for a solution to the CartPole problem from OpenAI Gym.

Chapter 7, Decoupling Exploration and Exploitation in Multi-Armed Bandits, covers the problem of multi-armed bandits and extends the concept of exploration versus exploitation. We will explore well-known examples of these problems and talk about why bandit problems are scientifically interesting.

Chapter 8, Further Q-Learning Research and Future Projects, covers a wide range of problems to consider for future projects in Q-learning. You will leave the chapter with a wealth of knowledge on how to continue your research as an RL practitioner.