Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
AI Crash Course

You're reading from   AI Crash Course A fun and hands-on introduction to machine learning, reinforcement learning, deep learning, and artificial intelligence with Python

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher Packt
ISBN-13 9781838645359
Length 360 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Hadelin de Ponteves Hadelin de Ponteves
Author Profile Icon Hadelin de Ponteves
Hadelin de Ponteves
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Welcome to the Robot World FREE CHAPTER 2. Discover Your AI Toolkit 3. Python Fundamentals – Learn How to Code in Python 4. AI Foundation Techniques 5. Your First AI Model – Beware the Bandits! 6. AI for Sales and Advertising – Sell like the Wolf of AI Street 7. Welcome to Q-Learning 8. AI for Logistics – Robots in a Warehouse 9. Going Pro with Artificial Brains – Deep Q-Learning 10. AI for Autonomous Vehicles – Build a Self-Driving Car 11. AI for Business – Minimize Costs with Deep Q-Learning 12. Deep Convolutional Q-Learning 13. AI for Games – Become the Master at Snake 14. Recap and Conclusion 15. Other Books You May Enjoy 16. Index

AI solution

As always, the AI solution for deep Q-learning consists of two parts:

  1. Brain – the neural network that will learn and take actions
  2. Experience replay memory – the memory that will store our experience; the neural network will learn from this memory

Let's tackle those now!

The brain

This part of the AI solution will be responsible for teaching, storing, and evaluating our neural network. To build it, we're going to use a CNN!

Why a CNN? When explaining the theory behind them, I mentioned that they're often used when "our environment as state returns images," and that's exactly what we're dealing with here. We've already established that the game state is going to be a stacked 3D array containing the last few game frames.

In the previous chapter, we discussed that a CNN takes a 2D image as input, not a stacked 3D array of images; but do you remember this graphic?

https://lh5.googleusercontent.com/qjfDY_d7Dvn92gkZ2KDpPAoy-SM_7AO8RExLTjtj-FYCQcCDVIrfSjvgslPBBT5kAneqJMRbJKAOikeslS-1T5TQaPDDxX338ko4DWQxi5xPggLbosb-p3tR8y5DDGp-blxs1aqj

Figure 4...

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 $19.99/month. Cancel anytime