Python Machine Learning Cookbook

Book description

100 recipes that teach you how to perform various machine learning tasks in the real world

About This Book

  • Understand which algorithms to use in a given context with the help of this exciting recipe-based guide
  • Learn about perceptrons and see how they are used to build neural networks
  • Stuck while making sense of images, text, speech, and real estate? This guide will come to your rescue, showing you how to perform machine learning for each one of these using various techniques

Who This Book Is For

This book is for Python programmers who are looking to use machine-learning algorithms to create real-world applications. This book is friendly to Python beginners, but familiarity with Python programming would certainly be useful to play around with the code.

What You Will Learn

  • Explore classification algorithms and apply them to the income bracket estimation problem
  • Use predictive modeling and apply it to real-world problems
  • Understand how to perform market segmentation using unsupervised learning
  • Explore data visualization techniques to interact with your data in diverse ways
  • Find out how to build a recommendation engine
  • Understand how to interact with text data and build models to analyze it
  • Work with speech data and recognize spoken words using Hidden Markov Models
  • Analyze stock market data using Conditional Random Fields
  • Work with image data and build systems for image recognition and biometric face recognition
  • Grasp how to use deep neural networks to build an optical character recognition system

In Detail

Machine learning is becoming increasingly pervasive in the modern data-driven world. It is used extensively across many fields such as search engines, robotics, self-driving cars, and more.

With this book, you will learn how to perform various machine learning tasks in different environments. We'll start by exploring a range of real-life scenarios where machine learning can be used, and look at various building blocks. Throughout the book, you'll use a wide variety of machine learning algorithms to solve real-world problems and use Python to implement these algorithms.

You'll discover how to deal with various types of data and explore the differences between machine learning paradigms such as supervised and unsupervised learning. We also cover a range of regression techniques, classification algorithms, predictive modeling, data visualization techniques, recommendation engines, and more with the help of real-world examples.

Style and approach

You will explore various real-life scenarios in this book where machine learning can be used, and learn about different building blocks of machine learning using independent recipes in the book.

Table of contents

  1. Python Machine Learning Cookbook
    1. Table of Contents
    2. Python Machine Learning Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why Subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. The Realm of Supervised Learning
      1. Introduction
      2. Preprocessing data using different techniques
        1. Getting ready
        2. How to do it…
          1. Mean removal
          2. Scaling
          3. Normalization
          4. Binarization
          5. One Hot Encoding
      3. Label encoding
        1. How to do it…
      4. Building a linear regressor
        1. Getting ready
        2. How to do it…
      5. Computing regression accuracy
        1. Getting ready
        2. How to do it…
      6. Achieving model persistence
        1. How to do it…
      7. Building a ridge regressor
        1. Getting ready
        2. How to do it…
      8. Building a polynomial regressor
        1. Getting ready
        2. How to do it…
      9. Estimating housing prices
        1. Getting ready
        2. How to do it…
      10. Computing the relative importance of features
        1. How to do it…
      11. Estimating bicycle demand distribution
        1. Getting ready
        2. How to do it…
        3. There's more…
    9. 2. Constructing a Classifier
      1. Introduction
      2. Building a simple classifier
        1. How to do it…
        2. There's more…
      3. Building a logistic regression classifier
        1. How to do it…
      4. Building a Naive Bayes classifier
        1. How to do it…
      5. Splitting the dataset for training and testing
        1. How to do it…
      6. Evaluating the accuracy using cross-validation
        1. Getting ready…
        2. How to do it…
      7. Visualizing the confusion matrix
        1. How to do it…
      8. Extracting the performance report
        1. How to do it…
      9. Evaluating cars based on their characteristics
        1. Getting ready
        2. How to do it…
      10. Extracting validation curves
        1. How to do it…
      11. Extracting learning curves
        1. How to do it…
      12. Estimating the income bracket
        1. How to do it…
    10. 3. Predictive Modeling
      1. Introduction
      2. Building a linear classifier using Support Vector Machine (SVMs)
        1. Getting ready
        2. How to do it…
      3. Building a nonlinear classifier using SVMs
        1. How to do it…
      4. Tackling class imbalance
        1. How to do it…
      5. Extracting confidence measurements
        1. How to do it…
      6. Finding optimal hyperparameters
        1. How to do it…
      7. Building an event predictor
        1. Getting ready
        2. How to do it…
      8. Estimating traffic
        1. Getting ready
        2. How to do it…
    11. 4. Clustering with Unsupervised Learning
      1. Introduction
      2. Clustering data using the k-means algorithm
        1. How to do it…
      3. Compressing an image using vector quantization
        1. How to do it…
      4. Building a Mean Shift clustering model
        1. How to do it…
      5. Grouping data using agglomerative clustering
        1. How to do it…
      6. Evaluating the performance of clustering algorithms
        1. How to do it…
      7. Automatically estimating the number of clusters using DBSCAN algorithm
        1. How to do it…
      8. Finding patterns in stock market data
        1. How to do it…
      9. Building a customer segmentation model
        1. How to do it…
    12. 5. Building Recommendation Engines
      1. Introduction
      2. Building function compositions for data processing
        1. How to do it…
      3. Building machine learning pipelines
        1. How to do it…
        2. How it works…
      4. Finding the nearest neighbors
        1. How to do it…
      5. Constructing a k-nearest neighbors classifier
        1. How to do it…
        2. How it works…
      6. Constructing a k-nearest neighbors regressor
        1. How to do it…
        2. How it works…
      7. Computing the Euclidean distance score
        1. How to do it…
      8. Computing the Pearson correlation score
        1. How to do it…
      9. Finding similar users in the dataset
        1. How to do it…
      10. Generating movie recommendations
        1. How to do it…
    13. 6. Analyzing Text Data
      1. Introduction
      2. Preprocessing data using tokenization
        1. How to do it…
      3. Stemming text data
        1. How to do it…
        2. How it works…
      4. Converting text to its base form using lemmatization
        1. How to do it…
      5. Dividing text using chunking
        1. How to do it…
      6. Building a bag-of-words model
        1. How to do it…
        2. How it works…
      7. Building a text classifier
        1. How to do it…
        2. How it works…
      8. Identifying the gender
        1. How to do it…
      9. Analyzing the sentiment of a sentence
        1. How to do it…
        2. How it works…
      10. Identifying patterns in text using topic modeling
        1. How to do it…
        2. How it works…
    14. 7. Speech Recognition
      1. Introduction
      2. Reading and plotting audio data
        1. How to do it…
      3. Transforming audio signals into the frequency domain
        1. How to do it…
      4. Generating audio signals with custom parameters
        1. How to do it…
      5. Synthesizing music
        1. How to do it…
      6. Extracting frequency domain features
        1. How to do it…
      7. Building Hidden Markov Models
        1. How to do it…
      8. Building a speech recognizer
        1. How to do it…
    15. 8. Dissecting Time Series and Sequential Data
      1. Introduction
      2. Transforming data into the time series format
        1. How to do it…
      3. Slicing time series data
        1. How to do it…
      4. Operating on time series data
        1. How to do it…
      5. Extracting statistics from time series data
        1. How to do it…
      6. Building Hidden Markov Models for sequential data
        1. Getting ready
        2. How to do it…
      7. Building Conditional Random Fields for sequential text data
        1. Getting ready
        2. How to do it…
      8. Analyzing stock market data using Hidden Markov Models
        1. How to do it…
    16. 9. Image Content Analysis
      1. Introduction
      2. Operating on images using OpenCV-Python
        1. How to do it…
      3. Detecting edges
        1. How to do it…
      4. Histogram equalization
        1. How to do it…
      5. Detecting corners
        1. How to do it…
      6. Detecting SIFT feature points
        1. How to do it…
      7. Building a Star feature detector
        1. How to do it…
      8. Creating features using visual codebook and vector quantization
        1. How to do it…
      9. Training an image classifier using Extremely Random Forests
        1. How to do it…
      10. Building an object recognizer
        1. How to do it…
    17. 10. Biometric Face Recognition
      1. Introduction
      2. Capturing and processing video from a webcam
        1. How to do it…
      3. Building a face detector using Haar cascades
        1. How to do it…
      4. Building eye and nose detectors
        1. How to do it…
      5. Performing Principal Components Analysis
        1. How to do it…
      6. Performing Kernel Principal Components Analysis
        1. How to do it…
      7. Performing blind source separation
        1. How to do it…
      8. Building a face recognizer using Local Binary Patterns Histogram
        1. How to do it…
    18. 11. Deep Neural Networks
      1. Introduction
      2. Building a perceptron
        1. How to do it…
      3. Building a single layer neural network
        1. How to do it…
      4. Building a deep neural network
        1. How to do it…
      5. Creating a vector quantizer
        1. How to do it…
      6. Building a recurrent neural network for sequential data analysis
        1. How to do it…
      7. Visualizing the characters in an optical character recognition database
        1. How to do it…
      8. Building an optical character recognizer using neural networks
        1. How to do it…
    19. 12. Visualizing Data
      1. Introduction
      2. Plotting 3D scatter plots
        1. How to do it…
      3. Plotting bubble plots
        1. How to do it…
      4. Animating bubble plots
        1. How to do it…
      5. Drawing pie charts
        1. How to do it…
      6. Plotting date-formatted time series data
        1. How to do it…
      7. Plotting histograms
        1. How to do it…
      8. Visualizing heat maps
        1. How to do it…
      9. Animating dynamic signals
        1. How to do it…
    20. Index

Product information

  • Title: Python Machine Learning Cookbook
  • Author(s): Prateek Joshi
  • Release date: June 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781786464477