MLA-C01 Question 157
Single answerYou are building a machine learning model on AWS to predict customer churn for a subscription service. The model requires preprocessing of raw data stored in Amazon S3, feature engineering, and model training using Amazon SageMaker. You want to ensure that the preprocessing steps and feature engineering are automatically applied during inference. Which approach should you use to achieve this?
- A
Use SageMaker Processing jobs to preprocess the data and save the processed data in a new S3 bucket.
- B
Implement preprocessing and feature engineering directly in the training script using SageMaker's built-in containers.
- C
Deploy the preprocessing and model training pipelines separately, and preprocess data prior to sending it for inference.
- D
Use SageMaker Pipelines to define preprocessing as a step and create a model endpoint with a preprocessor and model combined using a SageMaker Inference Pipeline.
Show answer and explanation
Correct answer: D
Explanation
The SageMaker Inference Pipeline is the recommended solution for scenarios where preprocessing and feature engineering need to be applied automatically during inference. By combining a preprocessor (implemented as a processing step) and the trained model into a single endpoint, the entire pipeline is executed seamlessly during both training and inference. This ensures consistency between preprocessing during training and inference, eliminating the need for manual intervention or replication of preprocessing steps.
- A. Incorrect.
While SageMaker Processing jobs can preprocess data efficiently, this approach does not automatically apply preprocessing during inference. It is suitable for offline preprocessing, not for ensuring preprocessing during real-time predictions.
- B. Incorrect.
Embedding preprocessing and feature engineering in the training script does not guarantee that these steps will be automatically applied during inference. You would need to replicate them manually in another service for inference.
- C. Incorrect.
Separating preprocessing and model training pipelines requires manual intervention to preprocess data before inference, which does not ensure an automated end-to-end solution.
- D. Correct.
Using SageMaker Pipelines to define preprocessing as a step and creating a SageMaker Inference Pipeline combines the preprocessing logic and the trained model into a single endpoint. This ensures that the preprocessing steps are automatically applied during inference.