Book Image

TensorFlow Deep Learning Projects

By : Alexey Grigorev, Rajalingappaa Shanmugamani
Book Image

TensorFlow Deep Learning Projects

By: Alexey Grigorev, Rajalingappaa Shanmugamani

Overview of this book

TensorFlow is one of the most popular frameworks used for machine learning and, more recently, deep learning. It provides a fast and efficient framework for training different kinds of deep learning models, with very high accuracy. This book is your guide to master deep learning with TensorFlow with the help of 10 real-world projects. TensorFlow Deep Learning Projects starts with setting up the right TensorFlow environment for deep learning. You'll learn how to train different types of deep learning models using TensorFlow, including Convolutional Neural Networks, Recurrent Neural Networks, LSTMs, and Generative Adversarial Networks. While doing this, you will build end-to-end deep learning solutions to tackle different real-world problems in image processing, recommendation systems, stock prediction, and building chatbots, to name a few. You will also develop systems that perform machine translation and use reinforcement learning techniques to play games. By the end of this book, you will have mastered all the concepts of deep learning and their implementation with TensorFlow, and will be able to build and train your own deep learning models with TensorFlow confidently.
Table of Contents (12 chapters)

Starting the project

After this long detour into reinforcement learning and the DQN approach, we are finally ready to start coding, having all the basic understanding of how to operate an OpenAI Gym environment and how to set a DQN approximation of a Q function. We simply start importing all the necessary packages:

import gym
from gym import wrappers
import numpy as np
import random, tempfile, os
from collections import deque
import tensorflow as tf

The tempfile module generates temporary files and directories that can be used as a temporary storage area for data files. The deque command, from the collections module, creates a double-ended queue, practically a list where you can append items at the start or at the end. Interestingly, it can be set to a predefined size. When full, older items are discarded in order to make the place for new entries.

We will structure this project using...