24 Jan 2021

TensorFlow 2.x Reinforcement Learning Cookbook

TFRL Cookbook is a practical guide with over 50 short-&-sweet recipes to help you build, train and deploy learning agents for real-world applications


What is this book about?

With deep reinforcement learning, you can build intelligent agents, products, and services that can go beyond computer vision or perception to perform actions. TensorFlow 2.x is the latest major release of the most popular deep learning framework used to develop and train deep neural networks (DNNs). This book contains easy-to-follow recipes for leveraging TensorFlow 2.x to develop artificial intelligence applications.

Starting with an introduction to the fundamentals of deep reinforcement learning and TensorFlow 2.x, the book covers OpenAI Gym, model-based RL, model-free RL, and how to develop basic agents. You’ll discover how to implement advanced deep reinforcement learning algorithms such as actor-critic, deep deterministic policy gradients, deep-Q networks, proximal policy optimization, and deep recurrent Q-networks for training your RL agents. As you advance, you’ll explore the applications of reinforcement learning by building cryptocurrency trading agents, stock/share trading agents, and intelligent agents for automating task completion. Finally, you’ll find out how to deploy deep reinforcement learning agents to the cloud and build cross-platform apps using TensorFlow 2.x.

TF-RL-Cookbook TF-RL-Cookbook
(Left) Android RL Table-Tennis App, Ch9 (Right) Cross-platform Deep RL Agent deployment options, Ch9

By the end of this TensorFlow book, you’ll be able to:

Build: Deep RL agents from scratch using the all-new and powerful TensorFlow 2.x framework and Keras API
Implement: Deep RL algorithms (DQN, A3C, DDPG, PPO, SAC etc.) with minimal lines of code
Train: Deep RL agents in simulated environments (gyms) beyond toy-problems and games to perform real-world tasks like cryptocurrency trading, stock trading, tweet/email management and more!
Scale: Distributed training of RL agents using TensorFlow 2.x, Ray + Tune + RLLib
Deploy: RL agents to the cloud and edge for real-world testing by creating cloud services, web apps and Android mobile apps using TensorFlow Lite, TensorFlow.js, ONNX and Triton
TF-RL-Cookbook TF-RL-Cookbook
(Left) GridworldEnv, Ch1 (Right) Neural evolutionary agent learning performance, Ch1

This book covers the following exciting features:

  • Build deep reinforcement learning agents from scratch using the all-new TensorFlow 2.x and Keras API
  • Implement state-of-the-art deep reinforcement learning algorithms using minimal code
  • Build, train, and package deep RL agents for cryptocurrency and stock trading
  • Deploy RL agents to the cloud and edge to test them by creating desktop, web, and mobile apps and cloud services
  • Speed up agent development using distributed DNN model training
  • Explore distributed deep RL architectures and discover opportunities in AIaaS (AI as a Service)


If you feel this book is for you, get your copy today!


The chapter-wise recipes covered in the book are listed below with direct links to the code:

TFRL Cookbook recipes

Chapter 1: Developing building blocks for Deep RL using TensorFlow 2.x & Keras

  • 1.1 Building environment and reward mechanism for training RL agents

  • 1.2 Implementing neural-network-based RL policies for discrete action spaces and decision-making problems

  • 1.3 Implementing neural-network-based RL policies for continuous action spaces and continuous-control problems

  • 1.4 Working with OpenAI Gym for RL training environments

  • 1.5 Building a neural agent

  • 1.6 Building a neural evolutionary Agent

Chapter 2: Implementing value-based, policy gradients and actor-critic Deep RL algorithms

Chapter 3: Implementing Advanced (Deep) RL algorithms

Chapter 4: RL in real-world: Building cryptocurrency trading agents

Chapter 5: RL in real-world: Building stock/share trading agents

Chapter 6: RL in real-world: Building intelligent agents to complete your To-Dos

Chapter 7: Deploying Deep RL agents to the cloud

Chapter 8: Distributed training for accelerated development of Deep RL agents

Chapter 9: Deploying Deep RL agents on multiple platforms


Share on: