Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python Deep Learning

You're reading from  Python Deep Learning

Product type Book
Published in Apr 2017
Publisher Packt
ISBN-13 9781786464453
Pages 406 pages
Edition 1st Edition
Languages
Authors (4):
Valentino Zocca Valentino Zocca
Profile icon Valentino Zocca
Gianmario Spacagna Gianmario Spacagna
Profile icon Gianmario Spacagna
Daniel Slater Daniel Slater
Profile icon Daniel Slater
Peter Roelants Peter Roelants
Profile icon Peter Roelants
View More author details

Table of Contents (18) Chapters

Python Deep Learning
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Machine Learning – An Introduction Neural Networks Deep Learning Fundamentals Unsupervised Feature Learning Image Recognition Recurrent Neural Networks and Language Models Deep Learning for Board Games Deep Learning for Computer Games Anomaly Detection Building a Production-Ready Intrusion Detection System Index

Dynamic games


Now that we have learned the world's simplest game, let's try learning something a bit more dynamic. The cart pole task is a classic reinforcement learning problem. The agent must control a cart, on which is balanced a pole, attached to the cart via a joint. At every step, the agent can choose to move the cart left or right, and it receives a reward of 1 every time step that the pole is balanced. If the pole ever deviates by more than 15 degrees from upright, then the game ends:

Figure 5: The cart pole task

To run the cart pole task, we will use OpenAIGym, an open source project set up in 2015, which gives a way to run reinforcement learning agents against a range of environments in a consistent way. At the time of writing, OpenAIGym has support for running a whole range of Atari games and even some more complex games, such as doom, with minimum setup. It can be installed using pip by running this:

pip install gym[all]

Running cart pole in Python can be done as follows:

import...
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}