Machine Learning with Amazon SageMaker Cookbook - Joshua Arvin Lat - E-Book

Machine Learning with Amazon SageMaker Cookbook E-Book

Joshua Arvin Lat

0,0
39,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Amazon SageMaker is a fully managed machine learning (ML) service that helps data scientists and ML practitioners manage ML experiments. In this book, you'll use the different capabilities and features of Amazon SageMaker to solve relevant data science and ML problems.
This step-by-step guide features 80 proven recipes designed to give you the hands-on machine learning experience needed to contribute to real-world experiments and projects. You'll cover the algorithms and techniques that are commonly used when training and deploying NLP, time series forecasting, and computer vision models to solve ML problems. You'll explore various solutions for working with deep learning libraries and frameworks such as TensorFlow, PyTorch, and Hugging Face Transformers in Amazon SageMaker. You'll also learn how to use SageMaker Clarify, SageMaker Model Monitor, SageMaker Debugger, and SageMaker Experiments to debug, manage, and monitor multiple ML experiments and deployments. Moreover, you'll have a better understanding of how SageMaker Feature Store, Autopilot, and Pipelines can meet the specific needs of data science teams.
By the end of this book, you'll be able to combine the different solutions you've learned as building blocks to solve real-world ML problems.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 671

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Machine Learning with Amazon SageMaker Cookbook

80 proven recipes for data scientists and developers to perform machine learning experiments and deployments

Joshua Arvin Lat

BIRMINGHAM—MUMBAI

Machine Learning with Amazon SageMaker Cookbook

Copyright © 2021 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Publishing Product Manager: Sunith Shetty

Senior Editor: Mohammed Yusuf Imaratwale

Content Development Editor: Nazia Shaikh

Technical Editor: Arjun Varma

Copy Editor: Safis Editing

Project Coordinator: Aparna Ravikumar Nair

Proofreader: Safis Editing

Indexer: Tejal Daruwale Soni

Production Designer: Aparna Bhagat

First published: October 2021

Production reference: 2280921

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80056-703-0

www.packt.com

Dear reader. Thank you for purchasing this book! Years ago, I relied on "cookbooks" to help me gain the hands-on skills needed to get the job done using tech frameworks, libraries, tools, and services. It is my turn to give back to the tech community and provide you a "cookbook" with practical and complete solutions to help you in your machine learning journey. I hope this book helps you achieve your goals and dreams as well.

First, I would like to acknowledge Sunith Shetty, Gebin George, Aparna Nair, Nazia Shaikh, Arjun Varma, Shifa Ansari, and everyone from the Packt team for making this book a success. I would also like to thank Raphael Jambalos, Mark Jimenez, and Lauren Yu for their patient support in helping significantly improve the quality of this book. Writing a book is a team game and I am grateful to everyone who has contributed to this book.

Next, I would also like to thank Ross Barich, Julien Simon, Cameron Peron, and everyone from the AWS team for the advice and support that helped me write this book. I would also like to give my sincere thanks to the AWS teams who have built, developed, and managed the different features and capabilities of Amazon SageMaker. I would also like to acknowledge and thank Raphael Quisumbing and the leaders of AWS User Group Philippines. Years ago, it was just me, Raphael Quisumbing, Diwa del Mundo, and Mike Rayco, leading and organizing these tech events. Now, the user group has grown significantly bigger and we now have more leaders and contributors trying to make the tech world a better place.

I would like to give my sincere thanks to my parents and my sister for their never-ending love and support. At the same time, I would like to thank my relatives, friends, and colleagues at work. I would not be able to list all your names here but this acknowledgment section would not be complete without giving credit to the support and advice you all have given me throughout the years.

Finally, I want to dedicate this book to Sophie Soliven, who has been very supportive in my career choices and decisions. It all started with the "commute adventure" years ago and we did not expect that to become a lifelong journey.

Contributors

About the author

Joshua Arvin Lat is the Chief Technology Officer (CTO) of NuWorks Interactive Labs, Inc. He previously served as the CTO of three Australian-owned companies and also served as the Director for Software Development and Engineering for multiple e-commerce start-ups in the past, which allowed him to be more effective as a leader. Years ago, he and his team won first place in a global cybersecurity competition with their published research paper. He is also an AWS Machine Learning Hero and has shared his knowledge at several international conferences, discussing practical strategies on machine learning, engineering, security, and management.

About the reviewers

Lauren Yu is a former software engineer currently pursuing a career in law. She previously worked at AWS on Amazon SageMaker, primarily focusing on the SageMaker Python SDK, as well as toolkits and Docker images for integrating deep learning frameworks into Amazon SageMaker. While at Amazon, she also helped co-found the Amazon Symphony Orchestra of Seattle. In her spare time, she enjoys playing viola and learning more about the intersection of law and technology.

Raphael Jambalos is a cloud-native developer with 8 years of experience developing in Ruby and Python. He currently leads the cloud-native development team of eCloudValley Philippines, focused on designing and implementing various solutions such as serverless applications, CI/CD pipelines, load testing, and web development. He also holds four AWS certifications, with all three Associate-level certs and a Specialty certification in security.

Mark Jimenez is a software developer with a decade of experience in the industry ranging from web development and mobile development to machine learning. He holds several AWS certifications, including the AWS Certified Machine Learning – Specialty, AWS Certified Developer – Associate, and AWS Certified Solutions Architect – Associate certifications.

Table of Contents

Preface

Chapter 1: Getting Started with Machine Learning Using Amazon SageMaker

Technical requirements

Launching an Amazon SageMaker Notebook Instance

Getting ready

How to do it…

How it works…

Checking the versions of the SageMaker Python SDK and the AWS CLI

Getting ready

How to do it…

How it works…

Preparing the Amazon S3 bucket and the training dataset for the linear regression experiment

Getting ready

How to do it…

How it works…

Visualizing and understanding your data in Python

Getting ready

How to do it…

How it works…

Training your first model in Python

Getting ready

How to do it…

How it works…

There's more…

See also

Loading a linear learner model with Apache MXNet in Python

Getting ready

How to do it…

How it works…

Evaluating the model in Python

Getting ready

How to do it…

How it works…

There's more…

Deploying your first model in Python

Getting ready

How to do it…

How it works…

Invoking an Amazon SageMaker model endpoint with the SageMakerRuntime client from boto3

Getting ready

How to do it…

How it works…

Chapter 2: Building and Using Your Own Algorithm Container Image

Technical requirements

Launching and preparing the Cloud9 environment

Getting ready

How to do it…

How it works…

Setting up the Python and R experimentation environments

Getting ready

How to do it…

How it works…

There's more…

Preparing and testing the train script in Python

Getting ready

How to do it…

How it works…

There's more…

Preparing and testing the serve script in Python

Getting ready

How to do it…

How it works…

Building and testing the custom Python algorithm container image

Getting ready

How to do it…

How it works…

Pushing the custom Python algorithm container image to an Amazon ECR repository

Getting ready

How to do it…

How it works…

Using the custom Python algorithm container image for training and inference with Amazon SageMaker Local Mode

Getting ready

How to do it…

How it works…

Preparing and testing the train script in R

Getting ready

How to do it...

How it works…

There's more…

Preparing and testing the serve script in R

Getting ready

How to do it...

How it works…

Building and testing the custom R algorithm container image

Getting ready

How to do it...

How it works…

Pushing the custom R algorithm container image to an Amazon ECR repository

Getting ready

How to do it...

How it works…

Using the custom R algorithm container image for training and inference with Amazon SageMaker Local Mode

Getting ready

How to do it...

How it works…

Chapter 3: Using Machine Learning and Deep Learning Frameworks with Amazon SageMaker

Technical requirements

Preparing the SageMaker notebook instance for multiple deep learning local experiments

Getting ready

How to do it

How it works...

There's more...

Generating a synthetic dataset for deep learning experiments

Getting ready

How to do it

How it works...

Preparing the entrypoint TensorFlow and Keras training script

Getting ready

How to do it

How it works...

There's more...

Training and deploying a TensorFlow and Keras model with the SageMaker Python SDK

Getting ready

How to do it

How it works...

There's more...

See also

Preparing the entrypoint PyTorch training script

Getting ready

How to do it

How it works...

Preparing the entrypoint PyTorch inference script

Getting ready

How to do it

How it works...

Training and deploying a PyTorch model with the SageMaker Python SDK

Getting ready

How to do it

How it works...

See also

Preparing the entrypoint scikit-learn training script

Getting ready

How to do it

How it works...

Training and deploying a scikit-learn model with the SageMaker Python SDK

Getting ready

How to do it

How it works...

See also

Debugging disk space issues when using local mode

Getting ready

How to do it

How it works...

There's more...

Debugging container execution issues when using local mode

Getting ready

How to do it...

How it works...

There's more...

Chapter 4: Preparing, Processing, and Analyzing the Data

Technical requirements

Generating a synthetic dataset for anomaly detection experiments

Getting ready

How to do it…

How it works…

Training and deploying an RCF model

Getting ready…

How to do it…

How it works…

See also

Invoking machine learning models with Amazon Athena using SQL queries

Getting ready

How to do it…

How it works…

Analyzing data with Amazon Athena in Python

Getting ready

How to do it…

How it works…

Generating a synthetic dataset for analysis and transformation

Getting ready

How to do it…

How it works…

Performing dimensionality reduction with the built-in PCA algorithm

Getting ready

How to do it…

How it works…

See also

Performing cluster analysis with the built-in KMeans algorithm

Getting ready

How to do it…

How it works…

See also

Converting CSV data into protobuf recordIO format

Getting ready

How to do it…

How it works…

Training a KNN model using the protobuf recordIO training input type

Getting ready

How to do it…

How it works…

Preparing the SageMaker Processing prerequisites using the AWS CLI

Getting ready

How to do it…

How it works…

Managed data processing with SageMaker Processing in Python

Getting ready

How to do it…

How it works…

There's more…

See also

Managed data processing with SageMaker Processing in R

Getting ready

How to do it…

How it works…

Chapter 5: Effectively Managing Machine Learning Experiments

Technical requirements

Synthetic data generation for classification problems

Getting ready

How to do it…

How it works…

There's more…

Identifying issues with SageMaker Debugger

Getting ready

How to do it…

How it works…

There's more…

See also

Inspecting SageMaker Debugger logs and results

Getting ready

How to do it…

How it works…

There's more…

See also

Running and managing multiple experiments with SageMaker Experiments

Getting ready

How to do it…

How it works…

There's more…

Experiment analytics with SageMaker Experiments

Getting ready

How to do it…

How it works…

Inspecting experiments, trials, and trial components with SageMaker Experiments

Getting ready

How to do it…

How it works…

There's more…

See also

Chapter 6: Automated Machine Learning in Amazon SageMaker

Technical requirements

Onboarding to SageMaker Studio

Getting ready

How to do it…

How it works…

There's more…

Generating a synthetic dataset with additional columns containing random values

Getting ready

How to do it…

How it works…

There's more…

Creating and monitoring a SageMaker Autopilot experiment in SageMaker Studio (console)

Getting ready

How to do it…

How it works…

Creating and monitoring a SageMaker Autopilot experiment using the SageMaker Python SDK

Getting ready

How to do it…

How it works…

There's more…

Inspecting the SageMaker Autopilot experiment's results and artifacts

Getting ready

How to do it…

How it works…

Performing Automatic Model Tuning with the SageMaker XGBoost built-in algorithm

Getting ready

How to do it…

How it works…

There's more…

See also

Analyzing the Automatic Model Tuning job results

Getting ready

How to do it…

How it works…

Chapter 7: Working with SageMaker Feature Store, SageMaker Clarify, and SageMaker Model Monitor

Technical requirements

Generating a synthetic dataset and using SageMaker Feature Store for storage and management

Getting ready

How to do it…

How it works…

Querying data from the offline store of SageMaker Feature Store and uploading it to Amazon S3

Getting ready

How to do it…

How it works…

There's more…

Detecting pre-training bias with SageMaker Clarify

Getting ready

How to do it…

How it works…

There's more…

Detecting post-training bias with SageMaker Clarify

Getting ready

How to do it…

How it works…

Enabling ML explainability with SageMaker Clarify

Getting ready

How to do it…

How it works…

Deploying an endpoint from a model and enabling data capture with SageMaker Model Monitor

Getting ready

How to do it…

How it works…

Baselining and scheduled monitoring with SageMaker Model Monitor

Getting ready

How to do it…

How it works…

There's more…

See also

Chapter 8: Solving NLP, Image Classification, and Time-Series Forecasting Problems with Built-in Algorithms

Technical requirements

Generating a synthetic dataset for text classification problems

Getting ready

How to do it…

How it works…

There's more…

Preparing the test dataset for batch transform inference jobs

Getting ready

How to do it…

How it works…

Training and deploying a BlazingText model

Getting ready

How to do it…

How it works…

See more

Using Batch Transform for inference

Getting ready

How to do it…

How it works…

See also

Preparing the datasets for image classification using the Apache MXNet Vision Datasets classes

Getting ready

How to do it…

How it works…

See also

Training and deploying an image classifier using the built-in Image Classification Algorithm in SageMaker

Getting ready

How to do it…

How it works…

There's more…

See also

Generating a synthetic time series dataset

Getting ready

How to do it…

How it works…

Performing the train-test split on a time series dataset

Getting ready

How to do it…

How it works…

Training and deploying a DeepAR model

Getting ready

How to do it…

How it works…

Performing probabilistic forecasting with a deployed DeepAR model

Getting ready

How to do it...

How it works…

See also

Chapter 9: Managing Machine Learning Workflows and Deployments

Technical requirements

Working with Hugging Face models

Getting ready

How to do it…

How it works…

There's more…

See also

Preparing the prerequisites of a multi-model endpoint deployment

Getting ready

How to do it…

How it works…

Hosting multiple models with multi-model endpoints

Getting ready

How to do it…

How it works…

Setting up A/B testing on multiple models with production variants

Getting ready

How to do it…

How it works…

There's more…

Preparing the Step Functions execution role

Getting ready

How to do it…

How it works…

Managing ML workflows with AWS Step Functions and the Data Science SDK

Getting ready

How to do it…

How it works…

See also

Managing ML workflows with SageMaker Pipelines

Getting ready

How to do it…

How it works…

See also

Other Books You May Enjoy