Building Machine Learning Systems with Python - Third Edition

Book description

Get more from your data by creating practical machine learning systems with Python

Key Features

  • Develop your own Python-based machine learning system
  • Discover how Python offers multiple algorithms for modern machine learning systems
  • Explore key Python machine learning libraries to implement in your projects

Book Description

Machine learning allows systems to learn things without being explicitly programmed to do so. Python is one of the most popular languages used to develop machine learning applications, which take advantage of its extensive library support. This third edition of Building Machine Learning Systems with Python addresses recent developments in the field by covering the most-used datasets and libraries to help you build practical machine learning systems.

Using machine learning to gain deeper insights from data is a key skill required by modern application developers and analysts alike. Python, being a dynamic language, allows for fast exploration and experimentation. This book shows you exactly how to find patterns in your raw data. You will start by brushing up on your Python machine learning knowledge and being introduced to libraries. You'll quickly get to grips with serious, real-world projects on datasets, using modeling and creating recommendation systems. With Building Machine Learning Systems with Python, you'll gain the tools and understanding required to build your own systems, all tailored to solve real-world data analysis problems.

By the end of this book, you will be able to build machine learning systems using techniques and methodologies such as classification, sentiment analysis, computer vision, reinforcement learning, and neural networks.

What you will learn

  • Build a classification system that can be applied to text, images, and sound
  • Employ Amazon Web Services (AWS) to run analysis on the cloud
  • Solve problems related to regression using scikit-learn and TensorFlow
  • Recommend products to users based on their past purchases
  • Understand different ways to apply deep neural networks on structured data
  • Address recent developments in the field of computer vision and reinforcement learning

Who this book is for

Building Machine Learning Systems with Python is for data scientists, machine learning developers, and Python developers who want to learn how to build increasingly complex machine learning systems. You will use Python's machine learning capabilities to develop effective solutions. Prior knowledge of Python programming is expected.

Publisher resources

Download Example Code

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Building Machine Learning Systems with Python Third Edition
  3. Packt Upsell
    1. Why subscribe?
  4. Contributors
    1. About the authors
    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. Get in touch
      1. Reviews
  6. Getting Started with Python Machine Learning
    1. Machine learning and Python – a dream team
      1. What the book will teach you – and what it will not
      2. How to best read this book
      3. What to do when you are stuck
      4. Getting started
        1. Introduction to NumPy, SciPy, Matplotlib, and TensorFlow
        2. Installing Python
        3. Chewing data efficiently with NumPy and intelligently with SciPy
        4. Learning NumPy
          1. Indexing
          2. Handling nonexistent values
          3. Comparing the runtime
        5. Learning SciPy
      5. Fundamentals of machine learning
        1. Asking a question
        2. Getting answers
      6. Our first (tiny) application of machine learning
        1. Reading in the data
        2. Preprocessing and cleaning the data
        3. Choosing the right model and learning algorithm
          1. Before we build our first model
          2. Starting with a simple straight line
          3. Toward more complex models
          4. Stepping back to go forward - another look at our data
          5. Training and testing
          6. Answering our initial question
    2. Summary
  7. Classifying with Real-World Examples
    1. The Iris dataset
      1. Visualization is a good first step
      2. Classifying with scikit-learn
      3. Building our first classification model
    2. Evaluation – holding out data and cross-validation
    3. How to measure and compare classifiers
    4. A more complex dataset and the nearest-neighbor classifier
      1. Learning about the seeds dataset
      2. Features and feature engineering
      3. Nearest neighbor classification
      4. Looking at the decision boundaries
    5. Which classifier to use
    6. Summary
  8. Regression
    1. Predicting house prices with regression
    2. Multidimensional regression
    3. Cross-validation for regression
      1. Penalized or regularized regression
      2. L1 and L2 penalties
    4. Using Lasso or ElasticNet in scikit-learn
      1. Visualizing the Lasso path
      2. P-greater-than-N scenarios
      3. An example based on text documents
      4. Setting hyperparameters in a principled way
    5. Regression with TensorFlow
    6. Summary
  9. Classification I – Detecting Poor Answers
    1. Sketching our roadmap
    2. Learning to classify classy answers
      1. Tuning the instance
      2. Tuning the classifier
    3. Fetching the data
      1. Slimming the data down to chewable chunks
      2. Preselecting and processing attributes
      3. Defining what a good answer is
    4. Creating our first classifier
      1. Engineering the features
      2. Training the classifier
      3. Measuring the classifier's performance
      4. Designing more features
    5. Deciding how to improve the performance
      1. Bias, variance and their trade-off
      2. Fixing high bias
      3. Fixing high variance
      4. High or low bias?
    6. Using logistic regression
      1. A bit of math with a small example
      2. Applying logistic regression to our post-classification problem
    7. Looking behind accuracy – precision and recall
    8. Slimming the classifier
    9. Ship it!
    10. Classification using Tensorflow
    11. Summary
  10. Dimensionality Reduction
    1. Sketching our roadmap
    2. Selecting features
      1. Detecting redundant features using filters
        1. Correlation
        2. Mutual information
      2. Asking the model about the features using wrappers
      3. Other feature selection methods
    3. Feature projection
      1. Principal component analysis
        1. Sketching PCA
        2. Applying PCA
      2. Limitations of PCA and how LDA can help
    4. Multidimensional scaling
    5. Autoencoders, or neural networks for dimensionality reduction
    6. Summary
  11. Clustering – Finding Related Posts
    1. Measuring the relatedness of posts
      1. How not to do it
      2. How to do it
    2. Preprocessing – similarity measured as a similar number of common words
      1. Converting raw text into a bag of words
        1. Counting words
        2. Normalizing word count vectors
        3. Removing less important words
        4. Stemming
          1. Installing and using NLTK
          2. Extending the vectorizer with NLTK's stemmer
        5. Stop words on steroids
      2. Our achievements and goals
    3. Clustering
      1. K-means
      2. Getting test data to evaluate our ideas
      3. Clustering posts
    4. Solving our initial challenge
      1. Another look at noise
    5. Tweaking the parameters
    6. Summary
  12. Recommendations
    1. Rating predictions and recommendations
    2. Splitting into training and testing
    3. Normalizing the training data
    4. A neighborhood approach to recommendations
    5. A regression approach to recommendations
    6. Combining multiple methods
    7. Basket analysis
      1. Obtaining useful predictions
      2. Analyzing supermarket shopping baskets
    8. Association rule mining
      1. More advanced basket analysis
    9. Summary
  13. Artificial Neural Networks and Deep Learning
    1. Using TensorFlow
      1. TensorFlow API
      2. Graphs
      3. Sessions
      4. Useful operations
    2. Saving and restoring neural networks
      1. Training neural networks
      2. Convolutional neural networks
      3. Recurrent neural networks
    3. LSTM for predicting text
    4. LSTM for image processing
    5. Summary
  14. Classification II – Sentiment Analysis
    1. Sketching our roadmap
    2. Fetching the Twitter data
    3. Introducing the Naïve Bayes classifier
      1. Getting to know the Bayes theorem
      2. Being naïve
      3. Using Naïve Bayes to classify
      4. Accounting for unseen words and other oddities
      5. Accounting for arithmetic underflows
    4. Creating our first classifier and tuning it
      1. Solving an easy problem first
      2. Using all classes
      3. Tuning the classifier's parameters
    5. Cleaning tweets
    6. Taking the word types into account
      1. Determining the word types
      2. Successfully cheating using SentiWordNet
      3. Our first estimator
      4. Putting everything together
    7. Summary
  15. Topic Modeling
    1. Latent Dirichlet allocation
      1. Building a topic model
      2. Comparing documents by topic
      3. Modeling the whole of Wikipedia
      4. Choosing the number of topics
    2. Summary
  16. Classification III – Music Genre Classification
    1. Sketching our roadmap
    2. Fetching the music data
      1. Converting into WAV format
    3. Looking at music
      1. Decomposing music into sine-wave components
    4. Using FFT to build our first classifier
      1. Increasing experimentation agility
      2. Training the classifier
      3. Using a confusion matrix to measure accuracy in multiclass problems
      4. An alternative way to measure classifier performance using receiver-operator characteristics
    5. Improving classification performance with mel frequency cepstral coefficients
    6. Music classification using Tensorflow
    7. Summary
  17. Computer Vision
    1. Introducing image processing
      1. Loading and displaying images
      2. Thresholding
      3. Gaussian blurring
      4. Putting the center in focus
    2. Basic image classification
    3. Computing features from images
    4. Writing your own features
    5. Using features to find similar images
    6. Classifying a harder dataset
    7. Local feature representations
    8. Image generation with adversarial networks
    9. Summary
  18. Reinforcement Learning
    1. Types of reinforcement learning
      1. Policy and value network
      2. Q-network
    2. Excelling at games
      1. A small example
      2. Using Tensorflow for the text game
      3. Playing breakout
    3. Summary
  19. Bigger Data
    1. Learning about big data
      1. Using jug to break up your pipeline into tasks
      2. An introduction to tasks in jug
    2. Looking under the hood
    3. Using jug for data analysis
    4. Reusing partial results
    5. Using Amazon Web Services
    6. Creating your first virtual machines
    7. Installing Python packages on Amazon Linux
    8. Running jug on our cloud machine
    9. Automating the generation of clusters with cfncluster
    10. Summary
  20. Where to Learn More About Machine Learning
    1. Online courses
    2. Books
      1. Blogs
      2. Data sources
      3. Getting competitive
    3. All that was left out
    4. Summary
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Building Machine Learning Systems with Python - Third Edition
  • Author(s): Luis Pedro Coelho, Wilhelm Richert, Matthieu Brucher
  • Release date: July 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788623223