Book Image

Artificial Intelligence and Machine Learning Fundamentals

By : Zsolt Nagy
Book Image

Artificial Intelligence and Machine Learning Fundamentals

By: Zsolt Nagy

Overview of this book

Machine learning and neural networks are pillars on which you can build intelligent applications. Artificial Intelligence and Machine Learning Fundamentals begins by introducing you to Python and discussing AI search algorithms. You will cover in-depth mathematical topics, such as regression and classification, illustrated by Python examples. As you make your way through the book, you will progress to advanced AI techniques and concepts, and work on real-life datasets to form decision trees and clusters. You will be introduced to neural networks, a powerful tool based on Moore's law. By the end of this book, you will be confident when it comes to building your own AI applications with your newly acquired skills!
Table of Contents (10 chapters)
Artificial Intelligence and Machine Learning Fundamentals
Preface

Introduction


In the previous lesson, we understood the significance of an intelligent agent. We also examined the game states for a game AI. In this lesson, we will focus on how to create and introduce intelligence into an agent.

We will look at reducing the number of states in the state space and analyze the stages that a game board can undergo and make the environment work in such a way that we win. By the end of this lesson, we will have a Tic-Tac-Toe player who never loses a match.

Exercise 4: Teaching the Agent to Win

In this exercise, we will see how the steps needed to win can be reduced. We will be making the agent that we developed in the previous lesson detect situations where it can win a game. Compare the number of possible states to the random play as an example.

  1. We will be defining two functions, ai_move and all_moves_from_board. We will create ai_move so that it returns a move that will consider its own previous moves. If the game can be won in that move, ai_move will select...