Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning Engineering on AWS

You're reading from   Machine Learning Engineering on AWS Build, scale, and secure machine learning systems and MLOps pipelines in production

Arrow left icon
Product type Paperback
Published in Oct 2022
Publisher Packt
ISBN-13 9781803247595
Length 530 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Joshua Arvin Lat Joshua Arvin Lat
Author Profile Icon Joshua Arvin Lat
Joshua Arvin Lat
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Part 1: Getting Started with Machine Learning Engineering on AWS
2. Chapter 1: Introduction to ML Engineering on AWS FREE CHAPTER 3. Chapter 2: Deep Learning AMIs 4. Chapter 3: Deep Learning Containers 5. Part 2:Solving Data Engineering and Analysis Requirements
6. Chapter 4: Serverless Data Management on AWS 7. Chapter 5: Pragmatic Data Processing and Analysis 8. Part 3: Diving Deeper with Relevant Model Training and Deployment Solutions
9. Chapter 6: SageMaker Training and Debugging Solutions 10. Chapter 7: SageMaker Deployment Solutions 11. Part 4:Securing, Monitoring, and Managing Machine Learning Systems and Environments
12. Chapter 8: Model Monitoring and Management Solutions 13. Chapter 9: Security, Governance, and Compliance Strategies 14. Part 5:Designing and Building End-to-end MLOps Pipelines
15. Chapter 10: Machine Learning Pipelines with Kubeflow on Amazon EKS 16. Chapter 11: Machine Learning Pipelines with SageMaker Pipelines 17. Index 18. Other Books You May Enjoy

No-code machine learning with SageMaker Canvas

Before we proceed with using the more comprehensive set of SageMaker capabilities to perform ML experiments and deployments, let’s start by building a model using SageMaker Canvas. One of the great things about SageMaker Canvas is that no coding work is needed to build models and use them to perform predictions. Of course, SageMaker Autopilot would have a more powerful and flexible set of features, but SageMaker Canvas should help business analysts, data scientists, and junior ML engineers understand the ML process and get started building models right away.

Since our dataset has already been uploaded to the S3 bucket, we can start building and training our first SageMaker Canvas model:

  1. On the SageMaker Domain/Control Panel page, locate the row of the user we just created and click Launch app. Choose Canvas from the list of options available in the drop-down menu, as shown in the following screenshot:
Figure 1.15 – Launching SageMaker Canvas

Figure 1.15 – Launching SageMaker Canvas

As we can see, we can launch SageMaker Canvas from the SageMaker Domain/Control Panel page. We can launch SageMaker Studio here as well, which we’ll do later in this chapter.

  1. Click New model:
Figure 1.16 – The SageMaker Canvas Models page

Figure 1.16 – The SageMaker Canvas Models page

Here, we have the SageMaker Canvas Models page, which should list the models we have trained. Since we have not trained anything yet, we should see the You haven’t created any models yet message.

  1. In the Create new model popup window, specify the name of the model (for example, first-model) and click Create.
  2. When you see the Getting Started guide window, click Skip intro.
  3. Click Import data to canvas. Locate the S3 bucket we created earlier in the Uploading the dataset to S3 section. After that, locate the booking.train.csv and booking.test.csv files inside the Amazon S3/<S3 BUCKET>/datasets/bookings folder of the S3 bucket.
Figure 1.17 – Choose files to import

Figure 1.17 – Choose files to import

Select the necessary CSV files, as shown in the preceding screenshot, and click Import data.

Important note

Note that you may have a hard time locating the S3 bucket we created in the Uploading the dataset to S3 section if you have a significant number of S3 buckets in your account. Feel free to use the search box (with the Search Amazon S3 placeholder) located on the right-hand side, just above the table that lists the different S3 buckets and resources.

  1. Once the files have been imported, click the radio button of the row that contains bookings.train.csv. Click Select dataset.
  2. In the Build tab, click and open the Target column drop-down under Select a column to predict. Select is_cancelled from the list of drop-down options for the Target column field.
  3. Next, click Preview model (under the Quick build button), as highlighted in the following screenshot:
Figure 1.18 – The Build tab

Figure 1.18 – The Build tab

After a few minutes, we should get an estimated accuracy of around 70%. Note that you might get a different set of numbers in this step.

  1. Click Quick build and wait for the model to be ready.

Important note

This step may take up to 15 minutes to complete. While waiting, let’s quickly discuss the difference between Quick build and Standard build. Quick build uses fewer records for training and generally lasts around 2 to 15 minutes, while Standard build lasts much longer – generally around 2 to 4 hours. It is important to note that models that are trained using Quick build can’t be shared with other data scientists or ML engineers in SageMaker Studio. On the other hand, models trained using Standard build can be shared after the build has been completed.

  1. Once the results are available, you may open the Scoring tab by clicking the tab highlighted in the following screenshot:
Figure 1.19 – The Analyze tab

Figure 1.19 – The Analyze tab

We should see a quick chart showing the number of records that were used to analyze the model, along with the number of correct versus incorrect predictions the model has made.

Important note

At this point, we have built an ML model that we can use to predict whether a booking will be cancelled or not. Since the accuracy score in this example is only around 70%, we’re expecting the model to get about 7 correct answers every 10 tries. In Chapter 11, Machine Learning Pipelines with SageMaker Pipelines, we will train an improved version of this model with an accuracy score of around 88%.

  1. Once we are done checking the different numbers and charts in the Analyze tab, we can proceed by clicking the Predict button.
  2. Click Select dataset. Under Select dataset for predictions, choose bookings.test.csv and click Generate predictions.
  3. Once the Status column value is set to Ready, hover over the Status column of the row, click the 3 dots (which will appear after hovering over the row), and then select Preview from the list of options:
Figure 1.20 – Batch prediction results

Figure 1.20 – Batch prediction results

We should see a table of values, similar to what is shown in the preceding screenshot. In the first column, we should have the predicted values for the is_cancelled field for each of the rows of our test dataset. In the second column, we should find the probability of the prediction being correct.

Important note

Note that we can also perform a single prediction by using the interface provided after clicking Single prediction under Predict target values.

  1. Finally, let’s log out of our session. Click the Account icon in the left sidebar and select the Log out option.

Important note

Make sure that you always log out of the current session after using SageMaker Canvas to avoid any unexpected charges. For more information, go to https://docs.aws.amazon.com/sagemaker/latest/dg/canvas-log-out.html.

Wasn’t that easy? Now that we have a good idea of how to use SageMaker Canvas, let’s run an AutoML experiment using SageMaker Autopilot.

You have been reading a chapter from
Machine Learning Engineering on AWS
Published in: Oct 2022
Publisher: Packt
ISBN-13: 9781803247595
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image