Book Image

AI Crash Course

By : Hadelin de Ponteves
5 (2)
Book Image

AI Crash Course

5 (2)
By: Hadelin de Ponteves

Overview of this book

Welcome to the Robot World … and start building intelligent software now! Through his best-selling video courses, Hadelin de Ponteves has taught hundreds of thousands of people to write AI software. Now, for the first time, his hands-on, energetic approach is available as a book. Starting with the basics before easing you into more complicated formulas and notation, AI Crash Course gives you everything you need to build AI systems with reinforcement learning and deep learning. Five full working projects put the ideas into action, showing step-by-step how to build intelligent software using the best and easiest tools for AI programming, including Python, TensorFlow, Keras, and PyTorch. AI Crash Course teaches everyone to build an AI to work in their applications. Once you've read this book, you're only limited by your imagination.
Table of Contents (17 chapters)
16
Index

Building the environment

This time, as opposed to some of the other practical sections in this book, we don't have to specify any variables or make any assumptions. We can just go straight to the three crucial steps present in every deep Q-learning project:

  1. Defining the states
  2. Defining the actions
  3. Defining the rewards

Let's begin!

Defining the states

In every previous example, our states were a 1D vector that represented some values that define the environment. For example, for our self-driving car we had the information gathered from the three sensors around the car and the car's position. All of these were put into a single 1D array.

But what if we want to make something slightly more realistic? What if we want the AI to see and gather information from the same source as we do? Well, that's what we'll do in this chapter. Our AI will see exactly the same board as we see when playing Snake!

The state...