Machine Learning Engineering with Python

Book description

Supercharge the value of your machine learning models by building scalable and robust solutions that can serve them in production environments

Key Features

  • Explore hyperparameter optimization and model management tools
  • Learn object-oriented programming and functional programming in Python to build your own ML libraries and packages
  • Explore key ML engineering patterns like microservices and the Extract Transform Machine Learn (ETML) pattern with use cases

Book Description

Machine learning engineering is a thriving discipline at the interface of software development and machine learning. This book will help developers working with machine learning and Python to put their knowledge to work and create high-quality machine learning products and services.

Machine Learning Engineering with Python takes a hands-on approach to help you get to grips with essential technical concepts, implementation patterns, and development methodologies to have you up and running in no time. You'll begin by understanding key steps of the machine learning development life cycle before moving on to practical illustrations and getting to grips with building and deploying robust machine learning solutions. As you advance, you'll explore how to create your own toolsets for training and deployment across all your projects in a consistent way. The book will also help you get hands-on with deployment architectures and discover methods for scaling up your solutions while building a solid understanding of how to use cloud-based tools effectively. Finally, you'll work through examples to help you solve typical business problems.

By the end of this book, you'll be able to build end-to-end machine learning services using a variety of techniques and design your own processes for consistently performant machine learning engineering.

What you will learn

  • Find out what an effective ML engineering process looks like
  • Uncover options for automating training and deployment and learn how to use them
  • Discover how to build your own wrapper libraries for encapsulating your data science and machine learning logic and solutions
  • Understand what aspects of software engineering you can bring to machine learning
  • Gain insights into adapting software engineering for machine learning using appropriate cloud technologies
  • Perform hyperparameter tuning in a relatively automated way

Who this book is for

This book is for machine learning engineers, data scientists, and software developers who want to build robust software solutions with machine learning components. If you're someone who manages or wants to understand the production life cycle of these systems, you'll find this book useful. Intermediate-level knowledge of Python is necessary.

Table of contents

  1. Machine Learning Engineering with Python
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
  6. Section 1: What Is ML Engineering?
  7. Chapter 1: Introduction to ML Engineering
    1. Technical requirements
    2. Defining a taxonomy of data disciplines
      1. Data scientist
      2. ML engineer
      3. Data engineer
    3. Assembling your team
    4. ML engineering in the real world
    5. What does an ML solution look like?
      1. Why Python?
    6. High-level ML system design
      1. Example 1: Batch anomaly detection service
      2. Example 2: Forecasting API
      3. Example 3: Streamed classification
    7. Summary
  8. Chapter 2: The Machine Learning Development Process
    1. Technical requirements
    2. Setting up our tools
      1. Setting up an AWS account
    3. Concept to solution in four steps
      1. Discover
      2. Play
      3. Develop
      4. Deploy
    4. Summary
  9. Section 2: ML Development and Deployment
  10. Chapter 3: From Model to Model Factory
    1. Technical requirements
    2. Defining the model factory
    3. Designing your training system
      1. Training system design options
      2. Train-run
      3. Train-persist
    4. Retraining required
      1. Detecting drift
      2. Engineering features for consumption
      3. Engineering categorical features
      4. Engineering numerical features
    5. Learning about learning
      1. Defining the target
      2. Cutting your losses
      3. Hierarchies of automation
      4. Optimizing hyperparameters
      5. AutoML
      6. Auto-sklearn
    6. Persisting your models
    7. Building the model factory with pipelines
      1. Scikit-learn pipelines
      2. Spark ML pipelines
    8. Summary
  11. Chapter 4: Packaging Up
    1. Technical requirements
    2. Writing good Python
      1. Recapping the basics
      2. Tips and tricks
      3. Adhering to standards
      4. Writing good PySpark
    3. Choosing a style
      1. Object-oriented programming
      2. Functional programming
    4. Packaging your code
      1. Why package?
      2. Selecting use cases for packaging
      3. Designing your package
    5. Building your package
    6. Testing, logging, and error handling
      1. Testing
      2. Logging
      3. Error handling
    7. Not reinventing the wheel
    8. Summary
  12. Chapter 5: Deployment Patterns and Tools
    1. Technical requirements
    2. Architecting systems
    3. Exploring the unreasonable effectiveness of patterns
      1. Swimming in data lakes
      2. Microservices
      3. Event-based designs
      4. Batching
    4. Containerizing
    5. Hosting your own microservice on AWS
      1. Pushing to ECR
      2. Hosting on ECS
      3. Creating a load balancer
    6. Pipelining 2.0
      1. Revisiting CI/CD
    7. Summary
  13. Chapter 6: Scaling Up
    1. Technical requirements
    2. Scaling with Spark
      1. Spark tips and tricks
      2. Spark on the cloud
    3. Spinning up serverless infrastructure
    4. Containerizing at scale with Kubernetes
    5. Summary
  14. Section 3: End-to-End Examples
  15. Chapter 7: Building an Example ML Microservice
    1. Technical requirements
    2. Understanding the forecasting problem
    3. Designing our forecasting service
    4. Selecting the tools
    5. Executing the build
      1. Training pipeline and forecaster
      2. Training and forecast handlers
    6. Summary
  16. Chapter 8: Building an Extract Transform Machine Learning Use Case
    1. Technical requirements
    2. Understanding the batch processing problem
    3. Designing an ETML solution
    4. Selecting the tools
      1. Interfaces
      2. Scaling of models
      3. Scheduling of ETML pipelines
    5. Executing the build
      1. Not reinventing the wheel in practice
      2. Using the Gitflow workflow
      3. Injecting some engineering practices
    6. Why subscribe?
  17. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Machine Learning Engineering with Python
  • Author(s): Andrew P. McMahon
  • Release date: November 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781801079259