Book Image

Artificial Intelligence with Python Cookbook

By : Ben Auffarth
Book Image

Artificial Intelligence with Python Cookbook

By: Ben Auffarth

Overview of this book

Artificial intelligence (AI) plays an integral role in automating problem-solving. This involves predicting and classifying data and training agents to execute tasks successfully. This book will teach you how to solve complex problems with the help of independent and insightful recipes ranging from the essentials to advanced methods that have just come out of research. Artificial Intelligence with Python Cookbook starts by showing you how to set up your Python environment and taking you through the fundamentals of data exploration. Moving ahead, you’ll be able to implement heuristic search techniques and genetic algorithms. In addition to this, you'll apply probabilistic models, constraint optimization, and reinforcement learning. As you advance through the book, you'll build deep learning models for text, images, video, and audio, and then delve into algorithmic bias, style transfer, music generation, and AI use cases in the healthcare and insurance industries. Throughout the book, you’ll learn about a variety of tools for problem-solving and gain the knowledge needed to effectively approach complex problems. By the end of this book on AI, you will have the skills you need to write AI and machine learning algorithms, test them, and deploy them for production.
Table of Contents (13 chapters)

Artificial Intelligence (AI) is the field concerned with automating tasks in a way that exhibits some form of intelligence to human spectators. This apparent intelligence could be similar to human intelligence, or simply some insightful action a machine or program surprises us with. Since our understanding of the world improves along with our tools, our expectations of what would surprise us or strike us as intelligent are continuously being raised. Rodney Brooks, a well-known researcher in the field of AI, expressed this effect (often referred to as the AI effect):

Every time we figure out a piece of it, it stops being magical; we say, "Oh, that's just a computation." We used to joke that AI means "almost implemented."

(Cited from Kahn, Jennifer (March 2002). It's Alive, in Wired, 10 (30):

AI has made huge strides, especially over the last few years with the arrival of powerful hardware, such as Graphics Processing Units (GPUs) and now Tensor Processing Units (TPUs), that can facilitate more powerful models, such as deep learning models with hundreds of thousands, millions, or even billions of parameters. These models perform better and better on benchmarks, often reaching human or even super-human levels. Excitingly for anyone involved in the field, some of these models, trained for many thousands of hours that would be worth hundreds of thousands of dollars if run on Amazon Web Services (AWS), are available for download to play with and extend.

This giant leap in performance is especially remarkable in image processing, audio processing, and increasingly in natural language processing. Nowhere has this been as evident and as showcased in media as it has in games. While the 1997 chess match between Kasparov and Deep Blue is still in the mind of many people, it can be argued that the success of the machine against the human chess champion was mostly due to the brute-force searching and analyzing of 200 million positions per second on a powerful supercomputer. Since then, however, a combination of algorithmic and computational capacities has given machines proficiency and mastery in even more complex games.

The following table illustrates the progress in AI:

Game Champion year Legal states (log10)
Othello (reversi) 1997 28
Draughts (checkers) 1994 21
Chess 1997 46
Scrabble 2006
Shogi 2017 71
Go 2016 172
2p no-limit hold 'em 2017
Starcraft - 270+

Please refer to the Wikipedia article Progress in Artificial Intelligence for more information.
You can see, for a series of games of varying complexity (as per the third column, showing legal states in powers of 10), when AI reached the level of top human players. More generally, you can find out more about state-of-the-art performances in different disciplines on a dedicated website:

It is therefore more timely than ever to look at and learn to use the state-of-the-art methods in AI, and this is what this book is about. You'll find carefully chosen recipes that will help you refresh your knowledge and bring you up to date with cutting edge algorithms.

If you are looking to build AI solutions for work or even for your hobby projects, you will find this cookbook useful. With the help of easy-to-follow recipes, this book will take you through the AI algorithms required to build smart models for problem solving. By the end of this book, you'll be able to identify an AI approach for solving applied problems, implement and test algorithms, and deal with model versioning, reports, and monitoring.