Artificial Intelligence with Python

Book description

Build real-world Artificial Intelligence applications with Python to intelligently interact with the world around you

About This Book

  • Step into the amazing world of intelligent apps using this comprehensive guide
  • Enter the world of Artificial Intelligence, explore it, and create your own applications
  • Work through simple yet insightful examples that will get you up and running with Artificial Intelligence in no time

Who This Book Is For

This book is for Python developers who want to build real-world Artificial Intelligence applications. This book is friendly to Python beginners, but being familiar with Python would be useful to play around with the code. It will also be useful for experienced Python programmers who are looking to use Artificial Intelligence techniques in their existing technology stacks.

What You Will Learn

  • Realize different classification and regression techniques
  • Understand the concept of clustering and how to use it to automatically segment data
  • See how to build an intelligent recommender system
  • Understand logic programming and how to use it
  • Build automatic speech recognition systems
  • Understand the basics of heuristic search and genetic programming
  • Develop games using Artificial Intelligence
  • Learn how reinforcement learning works
  • Discover how to build intelligent applications centered on images, text, and time series data
  • See how to use deep learning algorithms and build applications based on it

In Detail

Artificial Intelligence is becoming increasingly relevant in the modern world where everything is driven by technology and data. It is used extensively across many fields such as search engines, image recognition, robotics, finance, and so on. We will explore various real-world scenarios in this book and you'll learn about various algorithms that can be used to build Artificial Intelligence applications.

During the course of this book, you will find out how to make informed decisions about what algorithms to use in a given context. Starting from the basics of Artificial Intelligence, you will learn how to develop various building blocks using different data mining techniques. You will see how to implement different algorithms to get the best possible results, and will understand how to apply them to real-world scenarios. If you want to add an intelligence layer to any application that's based on images, text, stock market, or some other form of data, this exciting book on Artificial Intelligence will definitely be your guide!

Style and approach

This highly practical book will show you how to implement Artificial Intelligence. The book provides multiple examples enabling you to create smart applications to meet the needs of your organization. In every chapter, we explain an algorithm, implement it, and then build a smart application.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

Publisher resources

Download Example Code

Table of contents

  1. Artificial Intelligence with Python
    1. Artificial Intelligence with Python
    2. Credits
    3. About the Author
    4. About the Reviewer
      1. Why subscribe?
    6. Customer Feedback
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction to Artificial Intelligence
      1. What is Artificial Intelligence?
      2. Why do we need to study AI?
      3. Applications of AI
      4. Branches of AI
      5. Defining intelligence using Turing Test
      6. Making machines think like humans
      7. Building rational agents
      8. General Problem Solver
        1. Solving a problem with GPS
      9. Building an intelligent agent
        1. Types of models
      10. Installing Python 3
        1. Installing on Ubuntu
        2. Installing on Mac OS X
        3. Installing on Windows
      11. Installing packages
      12. Loading data
      13. Summary
    9. 2. Classification and Regression Using Supervised Learning
      1. Supervised versus unsupervised learning
      2. What is classification?
      3. Preprocessing data
        1. Binarization
        2. Mean removal
        3. Scaling
        4. Normalization
      4. Label encoding
      5. Logistic Regression classifier
      6. Naïve Bayes classifier
      7. Confusion matrix
      8. Support Vector Machines
      9. Classifying income data using Support Vector Machines
      10. What is Regression?
      11. Building a single variable regressor
      12. Building a multivariable regressor
      13. Estimating housing prices using a Support Vector Regressor
      14. Summary
    10. 3. Predictive Analytics with Ensemble Learning
      1. What is Ensemble Learning?
        1. Building learning models with Ensemble Learning
      2. What are Decision Trees?
        1. Building a Decision Tree classifier
      3. What are Random Forests and Extremely Random Forests?
        1. Building Random Forest and Extremely Random Forest classifiers
        2. Estimating the confidence measure of the predictions
      4. Dealing with class imbalance
      5. Finding optimal training parameters using grid search
      6. Computing relative feature importance
      7. Predicting traffic using Extremely Random Forest regressor
      8. Summary
    11. 4. Detecting Patterns with Unsupervised Learning
      1. What is unsupervised learning?
      2. Clustering data with K-Means algorithm
      3. Estimating the number of clusters with Mean Shift algorithm
      4. Estimating the quality of clustering with silhouette scores
      5. What are Gaussian Mixture Models?
      6. Building a classifier based on Gaussian Mixture Models
      7. Finding subgroups in stock market using Affinity Propagation model
      8. Segmenting the market based on shopping patterns
      9. Summary
    12. 5. Building Recommender Systems
      1. Creating a training pipeline
      2. Extracting the nearest neighbors
      3. Building a K-Nearest Neighbors classifier
      4. Computing similarity scores
      5. Finding similar users using collaborative filtering
      6. Building a movie recommendation system
      7. Summary
    13. 6. Logic Programming
      1. What is logic programming?
      2. Understanding the building blocks of logic programming
      3. Solving problems using logic programming
      4. Installing Python packages
      5. Matching mathematical expressions
      6. Validating primes
      7. Parsing a family tree
      8. Analyzing geography
      9. Building a puzzle solver
      10. Summary
    14. 7. Heuristic Search Techniques
      1. What is heuristic search?
        1. Uninformed versus Informed search
      2. Constraint Satisfaction Problems
      3. Local search techniques
        1. Simulated Annealing
      4. Constructing a string using greedy search
      5. Solving a problem with constraints
      6. Solving the region-coloring problem
      7. Building an 8-puzzle solver
      8. Building a maze solver
      9. Summary
    15. 8. Genetic Algorithms
      1. Understanding evolutionary and genetic algorithms
      2. Fundamental concepts in genetic algorithms
      3. Generating a bit pattern with predefined parameters
      4. Visualizing the evolution
      5. Solving the symbol regression problem
      6. Building an intelligent robot controller
      7. Summary
    16. 9. Building Games With Artificial Intelligence
      1. Using search algorithms in games
      2. Combinatorial search
      3. Minimax algorithm
      4. Alpha-Beta pruning
      5. Negamax algorithm
      6. Installing easyAI library
      7. Building a bot to play Last Coin Standing
      8. Building a bot to play Tic-Tac-Toe
      9. Building two bots to play Connect Four™ against each other
      10. Building two bots to play Hexapawn against each other
      11. Summary
    17. 10. Natural Language Processing
      1. Introduction and installation of packages
      2. Tokenizing text data
      3. Converting words to their base forms using stemming
      4. Converting words to their base forms using lemmatization
      5. Dividing text data into chunks
      6. Extracting the frequency of terms using a Bag of Words model
      7. Building a category predictor
      8. Constructing a gender identifier
      9. Building a sentiment analyzer
      10. Topic modeling using Latent Dirichlet Allocation
      11. Summary
    18. 11. Probabilistic Reasoning for Sequential Data
      1. Understanding sequential data
      2. Handling time-series data with Pandas
      3. Slicing time-series data
      4. Operating on time-series data
      5. Extracting statistics from time-series data
      6. Generating data using Hidden Markov Models
      7. Identifying alphabet sequences with Conditional Random Fields
      8. Stock market analysis
      9. Summary
    19. 12. Building A Speech Recognizer
      1. Working with speech signals
      2. Visualizing audio signals
      3. Transforming audio signals to the frequency domain
      4. Generating audio signals
      5. Synthesizing tones to generate music
      6. Extracting speech features
      7. Recognizing spoken words
      8. Summary
    20. 13. Object Detection and Tracking
      1. Installing OpenCV
      2. Frame differencing
      3. Tracking objects using colorspaces
      4. Object tracking using background subtraction
      5. Building an interactive object tracker using the CAMShift algorithm
      6. Optical flow based tracking
      7. Face detection and tracking
        1. Using Haar cascades for object detection
        2. Using integral images for feature extraction
      8. Eye detection and tracking
      9. Summary
    21. 14. Artificial Neural Networks
      1. Introduction to artificial neural networks
        1. Building a neural network
        2. Training a neural network
      2. Building a Perceptron based classifier
      3. Constructing a single layer neural network
      4. Constructing a multilayer neural network
      5. Building a vector quantizer
      6. Analyzing sequential data using recurrent neural networks
      7. Visualizing characters in an Optical Character Recognition database
      8. Building an Optical Character Recognition engine
      9. Summary
    22. 15. Reinforcement Learning
      1. Understanding the premise
      2. Reinforcement learning versus supervised learning
      3. Real world examples of reinforcement learning
      4. Building blocks of reinforcement learning
      5. Creating an environment
      6. Building a learning agent
      7. Summary
    23. 16. Deep Learning with Convolutional Neural Networks
      1. What are Convolutional Neural Networks?
      2. Architecture of CNNs
      3. Types of layers in a CNN
      4. Building a perceptron-based linear regressor
      5. Building an image classifier using a single layer neural network
      6. Building an image classifier using a Convolutional Neural Network
      7. Summary

Product information

  • Title: Artificial Intelligence with Python
  • Author(s): Prateek Joshi
  • Release date: January 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781786464392