Machine Learning with Amazon SageMaker Cookbook
eBook - ePub

Machine Learning with Amazon SageMaker Cookbook

Joshua Arvin Lat

Share book
  1. 762 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Machine Learning with Amazon SageMaker Cookbook

Joshua Arvin Lat

Book details
Book preview
Table of contents
Citations

About This Book

A step-by-step solution-based guide to preparing building, training, and deploying high-quality machine learning models with Amazon SageMakerKey Features• Perform ML experiments with built-in and custom algorithms in SageMaker• Explore proven solutions when working with TensorFlow, PyTorch, Hugging Face Transformers, and scikit-learn• Use the different features and capabilities of SageMaker to automate relevant ML processesBook DescriptionAmazon 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.What you will learn• Train and deploy NLP, time series forecasting, and computer vision models to solve different business problems• Push the limits of customization in SageMaker using custom container images• Use AutoML capabilities with SageMaker Autopilot to create high-quality models• Work with effective data analysis and preparation techniques• Explore solutions for debugging and managing ML experiments and deployments• Deal with bias detection and ML explainability requirements using SageMaker Clarify• Automate intermediate and complex deployments and workflows using a variety of solutionsWho this book is forThis book is for developers, data scientists, and machine learning practitioners interested in using Amazon SageMaker to build, analyze, and deploy machine learning models with 80 step-by-step recipes. All you need is an AWS account to get things running. Prior knowledge of AWS, machine learning, and the Python programming language will help you to grasp the concepts covered in this book more effectively.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Machine Learning with Amazon SageMaker Cookbook an online PDF/ePUB?
Yes, you can access Machine Learning with Amazon SageMaker Cookbook by Joshua Arvin Lat in PDF and/or ePUB format, as well as other popular books in Informatik & Datenmodellierung- & design. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781800566125

Chapter 1: Getting Started with Machine Learning Using Amazon SageMaker

Machine learning (ML) is one of the most important topics in the world right now. Through the use of different algorithms and models, it can solve different practical problems and requirements, such as anomaly detection, forecasting, spam detection, image classification, and more. Performing a few experiments in your local machine will help get things started. However, once we need to deal with end-to-end experiments involving larger datasets, deep learning requirements, and production-grade model deployments, we will need a more dedicated set of solutions to help us effectively manage these experiments.
This is what Amazon SageMaker aims to accomplish. Amazon SageMaker is a fully managed ML service that brings together different solutions to speed up the process of preparing, building, training, and deploying ML models. As we go through each of the chapters in this book, we will see how it helps get things done much faster across the different phases of the ML process.
Figure 1.1 – Chapter 1 recipes
Figure 1.1 – Chapter 1 recipes
In this introductory chapter, we will perform a simplified end-to-end ML experiment using Amazon SageMaker. The goal of this chapter is to help get our feet wet and understand what it can do to help us train and deploy ML models quickly. As seen in Figure 1.1, we will see how Amazon SageMaker fits in the ML process. With a sample dataset, we will work our way toward building, analyzing, and deploying a model that predicts a professional's salary using the number of months of relevant managerial experience.
We will start by launching an Amazon SageMaker notebook instance where we will run our experiments. Once we have everything set up, we will visualize the data using the pandas data analysis and manipulation library and the matplotlib data visualization library. After that, we will use the SageMaker Python SDK when training our linear regression model. Once we have generated the model, we will then use the deep learning framework Apache MXNet to load the model file created and extract the parameters of the linear model. We will also use the metrics utilities from the sklearn library to evaluate the regression model we have prepared in this chapter. After we have performed the model evaluation step, we will use the SageMaker Python SDK to deploy our model to an inference endpoint. Finally, we will use the SageMakerRuntime client from boto3 to invoke our deployed Amazon SageMaker inference endpoint.
We will cover the following recipes in this chapter:
  • Launching an Amazon SageMaker notebook instance
  • Checking the versions of the SageMaker Python SDK and the AWS CLI
  • Preparing the Amazon S3 bucket and the training dataset for the linear regression experiment
  • Visualizing and understanding your data in Python
  • Training your first model in Python
  • Loading a Linear Learner model with Apache MXNet in Python
  • Evaluating the model in Python
  • Deploying your first model in Python
  • Invoking an Amazon SageMaker model endpoint with the SageMakerRuntime client from boto3
Once we have completed the recipes in this chapter, we will have a good idea of how we can use Amazon SageMaker in the different phases of the ML process. With that in mind, let's get things started!

Technical requirements

As long as you have an existing AWS account, the next steps will be a piece of cake. If you still do not have an AWS account, feel free to check the AWS Free Tier page and click Create a Free Account: https://aws.amazon.com/free/. After clicking the Create a Free Account button, you will be redirected to the Sign up for AWS page, as shown in Figure 1.2:
Figure 1.2 – Sign up for AWS
Figure 1.2 – Sign up for AWS
All you need to do is complete the steps here to complete the sign-up process. The Jupyter notebooks, source code, and CSV files used for each chapter are available in this repository: https://github.com/PacktPublishing/Machine-Learning-with-Amazon-SageMaker-Cookbook/tree/master/Chapter01.
Check out the following link to see the relevant Code in Action video:
https://bit.ly/38WpNDf

Launching an Amazon SageMaker Notebook Instance

In this recipe, we will set up an Amazon SageMaker notebook instance where we can run our ML experiments using Jupyter Notebooks. The SageMaker notebook instance is a fully managed ML compute instance running a collection of tools and applications such as the Jupyter Notebook app. With several tools and libraries already installed and ready to use, we can go straight into working on our ML experiments without having to worry about the installation and maintenanc...

Table of contents