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)

What this book covers

Chapter 1, Getting Started with Artificial Intelligence in Python, describes a basic setup with Python for data crunching and AI. We'll perform data loading in pandas, plotting, and writing first models in scikit-learn and Keras. Since data preparation is such a time-consuming activity, we will present state-of-the-art techniques to facilitate this activity.

Chapter 2, Advanced Topics in Supervised Machine Learning, explains how to deal with common issues in supervised machine learning problems, such as class imbalance, time series, and dealing with algorithmic bias.

Chapter 3, Patterns, Outliers, and Recommendations, goes through an example involving clustering in real-world situations, and how to detect anomalies and outliers in data using sklearn and Keras. Then we will cover how to build a nearest neighbor search for fuzzy string matching, collaborative filtering by building a latent space, and fraud detection in a graph network.

Chapter 4, Probabilistic Modeling, explains how to build probabilistic models for predicting stock prices, and how we estimate customer lifetimes, diagnose a disease, and quantify credit risk under conditions of uncertainty.

Chapter 5, Heuristic Search Techniques and Logical Inference, introduces a broad class of problem solving tools, starting with ontologies and knowledge-based reasoning, through to optimization in the context of satisfiability, and combinatorial optimization with methods such as Particle Swarm Optimization, a genetic algorithm. We will simulate the spread of a pandemic in a multi-agent system, implement a Monte-Carlo tree search for a chess engine, we'll write a basic logic solver, and we'll embed knowledge through a graph algorithm.

Chapter 6, Deep Reinforcement Learning, applies multi-armed bandits to website optimization, and implements the REINFORCE algorithm for control tasks and a deep Q network for a simple game.

Chapter 7, Advanced Image Applications, takes you on a journey from more basic to state-of-the-art approaches in image recognition. We'll then learn how to create image samples using generative adversarial networks, and then perform style transfer using an adversarial autoencoder.

Chapter 8, Working with Moving Images, starts with image detection on a video feed and then creates videos using a deep fake model.

Chapter 9, Deep Learning in Audio and Speech, classifies different voice commands, before going through a text-to-speech architecture, and concludes with a recipe for modeling and generating sequences of music with a recurrent neural network.

Chapter 10, Natural Language Processing, explains how to classify sentiment, create a chatbot, and translate a text using sequence-to-sequence models. Finally, we'll attempt to write a popular novel using state-of-the-art text generation models.

Chapter 11, Artificial Intelligence in Production, covers monitoring and model versioning, visualizations as dashboards, and explains how to secure a model against malicious hacking attacks that could leak user data.