Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Reinforcement Learning with Python

You're reading from  Hands-On Reinforcement Learning with Python

Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781788836524
Pages 318 pages
Edition 1st Edition
Languages
Author (1):
Sudharsan Ravichandiran Sudharsan Ravichandiran
Profile icon Sudharsan Ravichandiran

Table of Contents (16) Chapters

Preface Introduction to Reinforcement Learning Getting Started with OpenAI and TensorFlow The Markov Decision Process and Dynamic Programming Gaming with Monte Carlo Methods Temporal Difference Learning Multi-Armed Bandit Problem Deep Learning Fundamentals Atari Games with Deep Q Network Playing Doom with a Deep Recurrent Q Network The Asynchronous Advantage Actor Critic Network Policy Gradients and Optimization Capstone Project – Car Racing Using DQN Recent Advancements and Next Steps Assessments Other Books You May Enjoy

Neural networks in TensorFlow

Now, we will see how to build a basic neural network using TensorFlow, which predicts handwritten digits. We will use the popular MNIST dataset which has a collection of labeled handwritten images for training.

First, we must import TensorFlow and load the dataset from tensorflow.examples.tutorial.mnist:

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)

Now, we will see what we have in our data:

print("No of images in training set {}".format(mnist.train.images.shape))
print("No of labels in training set {}".format(mnist.train.labels.shape))

print("No of images in test set {}".format(mnist.test.images.shape))
print("No of labels in test set {}".format(mnist.test.labels.shape))

It will print the following:

No of...
lock icon The rest of the chapter is locked
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 $15.99/month. Cancel anytime}