Important note – Amazon SageMaker Modeling – MLS-C01 Study Guide

As you can see in Figure 9.2, Training offers Algorithms, Training jobs, and Hyperparameter tuning jobs. Let’s understand their usage:

  • Algorithms: This is the first step toward deciding on an algorithm that you are going to run on our cleaned data. You can either choose a custom algorithm or create a custom algorithm based on the use case. Otherwise, you can run SageMaker algorithms on the cleaned data.
  • Training jobs: You can create training jobs from a notebook instance via API calls. You can set the number of instances, input the data source details, perform checkpoint configuration, and output data configuration. Amazon SageMaker manages the training instances and stores the model artifacts as output in the specified location. Both incremental training (that is, to train the model from time to time for better results) and managed spot training (that is, to reduce costs) can also be achieved.
  • Hyperparameter tuning jobs: Usually, hyperparameters are set for an algorithm prior to the training process. During the training process, you let the algorithm figure out the best values for these parameters. With hyperparameter tuning, you obtain the best model that has the best value of hyperparameters. This can be done through a console or via API calls. The same can be orchestrated from a notebook instance too.

Inference has many offerings and is evolving every day:

  • Compilation jobs: If your model is trained using an ML framework such as Keras, MXNet, ONNX, PyTorch, TFLite, TensorFlow, or XGBoost, and your model artifacts are available on a S3 bucket, then you can choose either Target device or Target platform. The Target device option is used to specify where you will deploy your model, such as an AWS SageMaker ML instance or an AWS IoT Greengrass device. The Target platform option is used to decide the operating system, architecture, and accelerator on which you want your model to run. You can also store the compiled module in your S3 bucket for future use. This essentially helps you in cross-platform model deployment.
  • Model packages: These are used to create deployable SageMaker models. You can create your own algorithm, package it using the model package APIs, and publish it to AWS Marketplace.
  • Models: Models are created using model artifacts. They are similar to mathematical equations with variables; that is, you input the values for the variables and get an output. These models are stored in S3 and will be used for inference by the endpoints.
  • Endpoint configurations: Amazon SageMaker allows you to deploy multiple weighted models to a single endpoint. This means you can route a specific number of requests to one endpoint. What does this mean? Well, let’s say you have one model in use. You want to replace it with a new model. However, you cannot simply remove the first model that is already in use. In this scenario, you can use the VariantWeight API to make the endpoints serve 80% of the requests with the old model and 20% of the requests with the new model. This is the most common production scenario where the data changes rapidly and the model needs to be trained and tuned periodically. Another possible use case is to test the model results with live data, then a certain percentage of the requests can be routed to the new model, and the results can be monitored to ascertain the accuracy of the model on real-time unseen data.
  • Endpoints: These are used to create a URL to which the model is exposed and can be requested to give the model results as a response.
  • Batch transform jobs: If the use case demands that you infer results on several million records, then instead of individual inference jobs, you can run batch transform jobs on the unseen data. Note that there can be some confusion when you receive thousands of results from your model after parsing thousands of pieces of unseen data as a batch. To overcome this confusion, the InputFilter, JoinSource, and OutputFilter APIs can be used to associate input records with output results.

You have got an overview of Amazon SageMaker. Now, put your knowledge to work in the next section.

Important note

The Amazon SageMaker console keeps changing. There’s a possibility that when you are reading this book, the console might look different.