Labelling and Preparing Data for Machine Learning
This lesson explains how SageMaker AI tools label data, prepare it visually and reuse features consistently. A model is only as good as its data.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish SageMaker Ground Truth from SageMaker Ground Truth Plus.
- Describe how SageMaker Data Wrangler and SageMaker Feature Store prepare and reuse features.
- Identify the AWS services that store and prepare data at scale.
Labelling data
Supervised learning needs labelled examples, and labelling is often the most expensive part of a project. AWS offers two levels of help. With SageMaker Ground Truth, you run the labelling jobs yourself, using your own staff, vendors from AWS Marketplace or the Amazon Mechanical Turk workforce. Its active learning labels easy examples automatically with a model and sends only uncertain ones to people, which reduces cost. With SageMaker Ground Truth Plus, AWS manages everything: you upload the data and your requirements, and an expert AWS workforce delivers the labels. The following table summarises the two.
| Service | How it works |
|---|---|
| SageMaker Ground Truth | You run labelling jobs with your own staff, Marketplace vendors or Amazon Mechanical Turk. Active learning labels easy examples automatically and sends only uncertain ones to people |
| SageMaker Ground Truth Plus | Fully managed: you upload data and requirements, and an expert AWS workforce delivers the labels |
Ground Truth can also collect human preference data for fine-tuning and evaluating generative models.
Ground Truth
Preparing data and features
Two services help turn raw data into model inputs. SageMaker Data Wrangler imports data from sources such as Amazon S3, Amazon Redshift and Amazon EMR, shows its quality and distributions with visualisations and reports, and applies hundreds of built-in transformations, such as filling missing values, without code. SageMaker Feature Store is a central repository of features. Its online store returns features in milliseconds for real-time predictions, and its offline store keeps their history for training, so the same feature definitions are used in both places. The following table summarises the two services.
| Service | What it does |
|---|---|
| SageMaker Data Wrangler | Imports data from S3, Redshift, EMR and more; explores it with visualisations and quality reports; applies hundreds of built-in transformations without code |
| SageMaker Feature Store | Central repository of features: an online store for low-latency inference lookups and an offline store for training |
Reusing feature definitions avoids training-serving skew, where production inputs are calculated differently from training inputs.
Preparing data and features
Supporting AWS services
Several AWS services support the storage and preparation of data for machine learning. The following list describes them.
- Data usually lives in Amazon S3.
- Large-scale preparation uses AWS Glue or Amazon EMR; the Glue Data Catalog stores schemas.
- Amazon Macie finds sensitive data to remove or mask before training.
Sensitive training data
Labelling 50,000 product images
An online shop wants a model that recognises product categories in seller photos, but its 50,000 images have no labels. Labelling them by hand would take months. With SageMaker Ground Truth:
| Step | What happens |
|---|---|
| 1 | The team defines the categories and writes clear instructions with examples |
| 2 | Human labellers (the company's staff or a vendor workforce) label an initial batch |
| 3 | Active learning trains a model on those labels and labels the easy images automatically |
| 4 | Only images the model is unsure about go to people, cutting cost substantially |
| 5 | Labelled data is written to S3, ready for training |
If the company had no staff to manage labelling at all, Ground Truth Plus would provide an expert workforce and run the whole project. Either way, Amazon Macie should first scan any accompanying text data in S3, such as seller descriptions and CSV manifests, for personal information that should not be in a training set (Macie analyses text-based objects, not image content).
Why does label quality matter so much for supervised learning?
Show answer
The model learns from examples with the correct answers, so inconsistent or wrong labels teach it the wrong patterns. Label quality limits model quality.
Exam Tips
Remember for the exam
- To create labelled training data with human labellers, use SageMaker Ground Truth.
- Fully managed labelling with an AWS workforce is Ground Truth Plus.
- Visual, no-code data preparation is SageMaker Data Wrangler.
- To reuse features consistently for training and inference, use SageMaker Feature Store.
- To remove PII from training data, first find it with Amazon Macie.