Following the Stages of a Machine Learning Pipeline
This lesson explains how a machine learning project moves through a defined pipeline, from a business problem to a monitored model in production, and which AWS services support each stage.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the stages of a machine learning pipeline in order.
- Describe common feature engineering techniques.
- Distinguish hyperparameters from model parameters.
- Compare the sources of models: open-source pre-trained models, proprietary foundation models and custom models.
The stages in order
A machine learning project moves through a sequence of stages. It begins by defining the problem: which decision the model will support, how success will be measured, and whether ML is the right approach at all. Data is collected, often into Amazon S3, and then prepared: cleaned, de-duplicated, labelled and split, with exploratory data analysis (EDA) to understand its distributions and quality. Feature engineering turns raw data into useful model inputs, such as a customer's number of orders in the last 30 days.
The model is then trained on the training set, tuned by trying different hyperparameter settings and keeping the best on the validation set, and evaluated on the test set, including checks for bias. Finally it is deployed to serve predictions and monitored, so that it can be retrained when its quality falls. The following table summarises the stages and the AWS services that support each.
| Stage | What happens | AWS support |
|---|---|---|
| 1. Define the problem | Decide which decision the model supports, the success metric, and whether ML is right at all | — |
| 2. Collect data | Gather data from databases, logs, sensors or third parties | Amazon S3 |
| 3. Prepare data and EDA | Clean, de-duplicate, label, split; explore distributions and quality | Ground Truth, Data Wrangler, notebooks |
| 4. Feature engineering | Turn raw data into useful inputs | SageMaker Feature Store |
| 5. Train | Learn the model from the training set | SageMaker training jobs |
| 6. Tune | Try hyperparameter settings; keep the best on the validation set | SageMaker Automatic Model Tuning |
| 7. Evaluate | Measure on the test set; check for bias | SageMaker Clarify |
| 8. Deploy | Serve from an endpoint or batch job | SageMaker AI hosting |
| 9. Monitor and retrain | Watch for drift; retrain when quality falls | SageMaker Model Monitor |
The following diagram shows the stages with the AWS service for each.

The ML pipeline
Feature engineering
Feature engineering turns raw data into model inputs, for example:
- Extracting the day of the week from a date.
- Scaling numbers to similar ranges.
- Encoding categories as numbers.
- Combining fields, such as price per square foot.
Storing features in Feature Store lets training and inference use the same definitions.
Raw data to features
Hyperparameters versus parameters
Hyperparameters and parameters are both settings of a model, but they are set at different times by different parties. Hyperparameters are chosen by you before training starts and control how training works, such as the learning rate, the number of trees in a forest, the number of passes through the data (epochs) and the batch size. Tuning means trying different hyperparameter values to find the best. Parameters are learned by the algorithm during training, such as the weights and biases of a neural network; they are what the trained model actually consists of. The following table summarises the difference.
Set or learned?
Where models come from
A model can come from three sources, which trade speed and cost against control. An open-source pre-trained model, from SageMaker JumpStart or Hugging Face, can be used or adapted quickly and cheaply. A proprietary foundation model called through an API, as in Amazon Bedrock, needs no infrastructure at all. A custom model trained on your own data gives the most control and can be tailored exactly to the problem, but it takes the most effort, data and expertise. The following table summarises the options.
| Source | Trade-off |
|---|---|
| Open-source pre-trained model (SageMaker JumpStart, Hugging Face) | Fast and cheap |
| Proprietary foundation model through an API (Amazon Bedrock) | No infrastructure |
| Custom model trained on your data | Most control, most effort |
Where should the model come from?
Following one project through the pipeline
A delivery company wants to predict late deliveries so it can warn customers. Following the project through each stage shows what happens and which AWS tool helps:
| Stage | In this project |
|---|---|
| Define the problem | Predict whether a parcel will be late (classification); success = catch 80% of late parcels |
| Collect data | Two years of delivery records, weather data and traffic data in Amazon S3 |
| Prepare data | Remove duplicates, fill missing postcodes, label each delivery late or on time (Data Wrangler) |
| Feature engineering | Day of week, distance, driver's average delay, rain forecast (stored in Feature Store) |
| Train and tune | Train a gradient-boosted tree; Automatic Model Tuning tries learning rates and tree depths |
| Evaluate | On the held-back test set the model catches 84% of late parcels; Clarify checks for regional bias |
| Deploy | Real-time endpoint called when each parcel is scanned |
| Monitor | Model Monitor notices accuracy falling at Christmas, when patterns change; the model is retrained |
The learning rate and tree depth chosen in tuning are hyperparameters (set before training); the thresholds inside each tree are parameters the algorithm learns.
What is the difference between a hyperparameter and a model parameter?
Show answer
Hyperparameters, such as the learning rate or the number of trees, are set before training. Parameters, such as a network's weights, are learned from the data during training.
Exam Tips
Remember for the exam
- The stages run: problem definition, data collection, preparation and EDA, feature engineering, training, tuning, evaluation, deployment and monitoring.
- Creating useful inputs from raw data is feature engineering.
- Hyperparameters are set before training; parameters are learned during it.
- To find the best hyperparameters automatically, use SageMaker Automatic Model Tuning.
- Monitoring and retraining close the loop when data drifts.