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

Variables and operations

Variables are simply values that are allocated somewhere in the memory of our computer. They are similar to variables in mathematics. They can be anything: text, integers, or floats (a number with precision after the decimal point, such as 2.33).

To create a new variable, you only need to write this:

x = 2

In this case, we have named a variable x and set its value to 2.

As in mathematics, you can perform some operations on these variables. The most common operations are addition, subtraction, multiplication, and division. The way to write them in Python is like this:

x = x + 5   #x += 5
x = x - 3   #x -= 3
x = x * 2.5 #x *= 2.5
x = x / 3   #x /= 3

If you look at it for the first time, it doesn't make much sense—how can we write that x = x + 5?

In Python, and in most code, the "=" notation doesn't mean the two terms are equal. It means that we associate the new x value with the value of the old...