Artificial Intelligence with Python Cookbook

Book description

Work through practical recipes to learn how to solve complex machine learning and deep learning problems using Python

Key Features

  • Get up and running with artificial intelligence in no time using hands-on problem-solving recipes
  • Explore popular Python libraries and tools to build AI solutions for images, text, sounds, and images
  • Implement NLP, reinforcement learning, deep learning, GANs, Monte-Carlo tree search, and much more

Book Description

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.

What you will learn

  • Implement data preprocessing steps and optimize model hyperparameters
  • Delve into representational learning with adversarial autoencoders
  • Use active learning, recommenders, knowledge embedding, and SAT solvers
  • Get to grips with probabilistic modeling with TensorFlow probability
  • Run object detection, text-to-speech conversion, and text and music generation
  • Apply swarm algorithms, multi-agent systems, and graph networks
  • Go from proof of concept to production by deploying models as microservices
  • Understand how to use modern AI in practice

Who this book is for

This AI machine learning book is for Python developers, data scientists, machine learning engineers, and deep learning practitioners who want to learn how to build artificial intelligence solutions with easy-to-follow recipes. You'll also find this book useful if you're looking for state-of-the-art solutions to perform different machine learning tasks in various use cases. Basic working knowledge of the Python programming language and machine learning concepts will help you to work with code effectively in this book.

Publisher resources

Download Example Code

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Artificial Intelligence with Python Cookbook
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Get in touch
      1. Reviews
  6. Getting Started with Artificial Intelligence in Python
    1. Technical requirements
    2. Setting up a Jupyter environment
      1. Getting ready
      2. How to do it...
        1. Installing libraries with Google Colab
        2. Self-hosting a Jupyter Notebook environment
      3. How it works...
      4. There's more...
      5. See also
    3. Getting proficient in Python for AI
      1. Getting ready
      2. How to do it...
        1. Obtaining the history of Jupyter commands and outputs
          1. Execution history
          2. Outputs
        2. Auto-reloading packages
        3. Debugging
        4. Timing code execution
        5. Displaying progress bars
        6. Compiling your code
        7. Speeding up pandas DataFrames
        8. Parallelizing your code
      3. See also
    4. Classifying in scikit-learn, Keras, and PyTorch
      1. Getting ready
      2. How to do it...
        1. Visualizing data in seaborn
        2. Modeling in scikit-learn
        3. Modeling in Keras
        4. Modeling in PyTorch
      3. How it works...
        1. Neural network training
        2. The SELU activation function
        3. Softmax activation
        4. Cross-entropy
      4. See also
    5. Modeling with Keras
      1. Getting ready
      2. How to do it...
        1. Data loading and preprocessing
        2. Model training
      3. How it works...
        1. Maximal information coefficient
        2. Data generators
        3. Permutation importance
      4. See also
  7. Advanced Topics in Supervised Machine Learning
    1. Technical requirements
    2. Transforming data in scikit-learn
      1. Getting ready
      2. How to do it...
        1. Encoding ranges numerically
        2. Deriving higher-order features
        3. Combining transformations
      3. How it works...
      4. There's more...
      5. See also
    3. Predicting house prices in PyTorch
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Live decisioning customer values
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Active learning
        2. Hoeffding Tree
        3. Class weighting
      4. See also
    5. Battling algorithmic bias
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Forecasting CO2 time series
      1. Getting ready
      2. How to do it...
        1. Analyzing time series using ARIMA and SARIMA
      3. How it works...
      4. There's more...
      5. See also
  8. Patterns, Outliers, and Recommendations
    1. Clustering market segments
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    2. Discovering anomalies
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. k-nearest neighbors
        2. Isolation forest
        3. Autoencoder
      4. See also
    3. Representing for similarity search
      1. Getting ready
      2. How to do it...
        1. Baseline – string comparison functions
        2. Bag-of-characters approach
        3. Siamese neural network approach
      3. How it works...
    4. Recommending products
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Precision at k
        2. Matrix factorization
        3. The lightfm model
      4. See also
    5. Spotting fraudster communities
      1. Getting ready
      2. How to do it...
        1. Creating an adjacency matrix
        2. Community detection algorithms
        3. Evaluating the communities
      3. How it works...
        1. Graph community algorithms
          1. Louvain algorithm
          2. Girvan–Newman algorithm
        2. Information entropy
      4. There's more...
      5. See also
  9. Probabilistic Modeling
    1. Technical requirements
    2. Predicting stock prices with confidence
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Featurization
        2. Platt scaling
        3. Isotonic regression
        4. Naive Bayes
      4. See also
    3. Estimating customer lifetime value
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. The BG/NBD model
        2. The Gamma-Gamma model
      4. See also
    4. Diagnosing a disease
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Aleatoric uncertainty
        2. Negative log-likelihood
        3. Bernoulli distribution
        4. Metrics
      4. See also
    5. Stopping credit defaults
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Epistemic uncertainty
      4. See also
  10. Heuristic Search Techniques and Logical Inference
    1. Making decisions based on knowledge
      1. Getting ready
      2. How to do it...
        1. Logical reasoning
        2. Knowledge embedding
      3. How it works...
        1. Logical reasoning
        2. Logic provers
        3. Knowledge embedding
        4. Graph embedding with Walklets
      4. See also
    2. Solving the n-queens problem
      1. Getting ready
      2. How to do it...
        1. Genetic algorithm 
        2. Particle swarm optimization
        3. SAT solver
      3. How it works...
        1. Genetic algorithm
        2. Particle swarm optimization
        3. SAT solver
      4. See also
    3. Finding the shortest bus route
      1. Getting ready
      2. How to do it...
        1. Simulated annealing
        2. Ant colony optimization
      3. How it works...
        1. Simulated annealing
        2. Ant colony optimization
      4. See also
    4. Simulating the spread of a disease
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Writing a chess engine with Monte Carlo tree search
      1. Getting ready
      2. How to do it...
        1. Tree search
        2. Implementing a node
        3. Playing chess
      3. How it works...
      4. There's more...
      5. See also
  11. Deep Reinforcement Learning
    1. Technical requirements
    2. Optimizing a website
      1. How to do it...
      2. How it works...
      3. See also
    3. Controlling a cartpole
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. Watching our agents in the environment
        2. Using the RLlib library
      5. See also 
    4. Playing blackjack
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  12. Advanced Image Applications
    1. Technical requirements
    2. Recognizing clothing items
      1. Getting ready
      2. How to do it...
        1. Difference of Gaussians
        2. Multilayer perceptron
        3. LeNet5
        4. MobileNet transfer learning
      3. How it works...
        1. Difference of Gaussian
        2. LeNet5
        3. MobileNet transfer learning
      4. See also
    3. Generating images
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    4. Encoding images and style
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  13. Working with Moving Images
    1. Technical requirements
    2. Localizing objects
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Faking videos
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
        1. Deep fakes
        2. Detection of deep fakes
  14. Deep Learning in Audio and Speech
    1. Technical requirements
    2. Recognizing voice commands
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    3. Synthesizing speech from text
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Deep Convolutional Networks with Guided Attention
        2. WaveGAN
      4. There's more...
      5. See also
    4. Generating melodies
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  15. Natural Language Processing
    1. Technical requirements
    2. Classifying newsgroups
      1. Getting ready
      2. How to do it...
        1. Bag-of-words
        2. Word embeddings
        3. Custom word embeddings
      3. How it works...
        1. The CBOW algorithm
        2. TFIDF
      4. There's more...
      5. See also
    3. Chatting to users
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. ELIZA
        2. Eywa
      4. See also
    4. Translating a text from English to German
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Writing a popular novel
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  16. Artificial Intelligence in Production
    1. Technical requirements
    2. Visualizing model results
      1. Getting ready
      2. How to do it...
        1. Streamlit hello-world
        2. Creating our data app
      3. How it works...
      4. See also
    3. Serving a model for live decisioning
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Monitoring
      4. See also
    4. Securing a model against attack
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Differential privacy
        2. Private aggregation of teacher ensembles
      4. See also
  17. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Artificial Intelligence with Python Cookbook
  • Author(s): Ben Auffarth
  • Release date: October 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781789133967