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

When building an AI, the first thing we always have to do is define the environment. Defining an environment always requires the following three elements:

  • Defining the states
  • Defining the actions
  • Defining the rewards

These three elements have already been defined in the previous chapter on Q-learning, but let's quickly remind ourselves what they are.

The states

The state, at a specific time t, is the location where the robot is at that time t. However, remember, you have to encode the location names so that our AI can do the math.

At the risk of disappointing you, given all the crazy hype about AI, let's remain realistic and understand that Q-learning is nothing more than a bunch of math equations; just like any other AI model. Let's make the encoding integers start at 0, simply because indexes in Python start at 0:

Figure 5: Location to state mapping

The actions

The actions are the next possible...