MLA-C02 · LESSON 1
Data Preparation for ML and AI28% · 3 topics
Learn data collection and storage for ML and AI, transformation and feature engineering, and data quality validation and bias management.
1.1Collect and store data
1.1 Collect and store data.
Concept
ML data is collected from S3 (the center of the data lake), EFS and FSx for Lustre (shared files for fast training), databases and streaming (Kinesis, MSK). For efficient analytics and training, choose formats such as Parquet and ORC (columnar), RecordIO and TFRecord for SageMaker training, and JSON Lines. For RAG, also design the vector store and the knowledge base chunking strategy.
How it works / steps
- Confirm where data lives, its volume and update frequency
- Build a data lake in S3 and decide formats and partitions
- Use FSx for Lustre (integrated with S3) for fast training on large data
- Ingest streaming data with Kinesis and Firehose
- For RAG documents, decide the chunking strategy (fixed-size, hierarchical, semantic) and ingest
Workplace example
To shorten the time spent reading 5 TB of images from S3 for every training run, mount FSx for Lustre linked to S3 and read from it in the training job.
Common confusions and exam tips
- CSV is convenient, but columnar formats are more efficient for large data
- SageMaker training input has File mode, Pipe mode and Fast File mode
- Chunks that are too large lower retrieval accuracy; too small loses context
Mini quiz
Q1. You want to use data from a production DynamoDB table for training. Which is the most appropriate way to extract it without using production read capacity?
- Maximize the production table's read capacity and read it all at once during business hours
- Enable point-in-time recovery and export the table to S3
- Have staff copy data by hand from the app screen into a spreadsheet
- Run a script that scans the production table and reads every item for each training run
Show answer and explanation
Answer: B Enable point-in-time recovery and export the table to S3
DynamoDB export to S3 uses the point-in-time recovery feature and does not consume table read capacity.
Q2. You want to extract a large table from an RDS database to S3 as Parquet for analytics and training. Which is the most appropriate way to minimize impact on production?
- Read the full table from production with AWS DMS and move it to S3
- Create a read replica and write CSV from it to S3
- Export an RDS snapshot to S3, which outputs Parquet
- Read the table from production via a Glue JDBC connection and convert to Parquet
Show answer and explanation
Answer: C Export an RDS snapshot to S3, which outputs Parquet
RDS snapshot export outputs data to S3 as Parquet without putting load on the production instance. [Other options] DMS and Glue JDBC read from the production instance and add load. A read replica limits impact but adds cost and doesn't produce Parquet.
Reference links
1.2Data transformation, feature engineering and preprocessing
1.2 Perform data transformation, feature engineering and preprocessing.
Concept
Preprocessing includes handling missing values (dropping, imputing), handling outliers, scaling (standardization, normalization), encoding categorical variables (one-hot, label, target), tokenizing text and splitting data. Use SageMaker Data Wrangler (visual preparation), AWS Glue (ETL), Glue DataBrew (no-code cleaning) and SageMaker Processing, and share created features with SageMaker Feature Store (online and offline).
How it works / steps
- Explore the data and check missing values, outliers and distributions
- Handle missing values and outliers
- Scale numeric features and encode categorical variables
- Create new features, such as day of week from dates
- Register in Feature Store and use the same features in training and inference
Workplace example
For churn prediction, use Data Wrangler to create “contract length (months)” from the contract date, one-hot encode the plan, and use it for real-time inference from the Feature Store online store.
Common confusions and exam tips
- Using label encoding on unordered categories makes the model learn false magnitudes
- If preprocessing differs between training and inference, accuracy drops (share it with Feature Store)
- Using test-data information in preprocessing (data leakage) inflates evaluation
Mini quiz
Q1. With SageMaker Feature Store, you want to retrieve a customer's latest features in milliseconds for every inference from a web screen. What should you use?
- AWS Artifact
- Amazon S3 Glacier
- The offline store
- The online store
Show answer and explanation
Answer: D The online store
The online store returns the latest features with low latency. The offline store keeps history in S3 and is used to create training data.
Q2. Which statement about data leakage is incorrect?
- Since evaluation accuracy comes out high, performance in production is equally high even with leakage
- With leakage, evaluation accuracy looks higher than it really is
- It is when information unavailable at prediction time is included in training-data features
- Splitting time-series data randomly makes leakage likely
Show answer and explanation
Answer: A Since evaluation accuracy comes out high, performance in production is equally high even with leakage
With leakage, evaluation accuracy looks high, but in production that information is unavailable, so performance drops sharply.
Reference links
1.3Validate data quality and manage bias
1.3 Validate data quality and manage bias.
Concept
Check data quality with AWS Glue Data Quality (rules checking completeness, uniqueness and value ranges) and Data Wrangler reports. Measure bias with SageMaker Clarify pre-training bias metrics (class imbalance CI, difference in proportions of labels DPL and others). Address imbalanced data with resampling (over- and undersampling), synthesis such as SMOTE, and weighting. Use SageMaker Ground Truth for labeling.
How it works / steps
- Define quality rules (missing rate, value ranges) and check them in the pipeline
- Measure data skew per attribute (gender, age and so on) with Clarify
- Address imbalanced classes with resampling or weighting
- Raise label quality with Ground Truth and review by multiple workers
- Anonymize or mask personal information
Workplace example
In fraud detection data where fraud is only 0.5%, increase fraud samples in the training data with SMOTE, and evaluate on test data with the original distribution.
Common confusions and exam tips
- With imbalanced data, accuracy can look high yet be useless
- Apply resampling only to training data (not to test data)
- Clarify can measure bias both before training (data) and after training (model)
Mini quiz
Q1. What does the SageMaker Clarify pre-training metric “class imbalance (CI)” indicate? Choose the most appropriate.
- The degree to which a trained model's prediction accuracy declines over time
- The degree to which a training job takes longer than planned
- The degree to which record counts are skewed between the groups compared (for example, gender)
- The degree to which data file sizes exceed the storage limit
Show answer and explanation
Answer: C The degree to which record counts are skewed between the groups compared (for example, gender)
CI expresses the imbalance in the number of samples between groups. A large imbalance tends to lower performance for the smaller group.
Q2. You want to lower the cost of labeling hundreds of thousands of images while maintaining the quality of human workers. Which is the most appropriate method?
- Skip labeling, infer contents from image file names and use those guesses as correct labels
- Assign all images to one worker and have the same person do the review as well
- Use Ground Truth automated labeling: the model labels items it is confident about, and people label the rest
- Reduce the images to 100 and do not use the rest for training at all
Show answer and explanation
Answer: C Use Ground Truth automated labeling: the model labels items it is confident about, and people label the rest
Ground Truth automated labeling (active learning) labels high-confidence data automatically, reducing the amount and cost of human work.
Reference links
Lessons are written by this site based on public information and do not guarantee exam content. Product specifications change, so check the latest information at the reference links.
Notes (unofficial, original questions, no pass guarantee)
- The questions on this site are original practice questions written by this site based on publicly available skills outlines and exam guides. They are not actual exam questions.
- Amazon Web Services, AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. This site is not affiliated with or endorsed by AWS.
- This content is a study aid and does not guarantee a pass. Exam content, format and prerequisites may change without notice; always check the latest information on the official page before taking the exam.
- Your accuracy on the mock exam cannot be converted to the official (scaled) score and does not predict a pass or fail.
- Progress is saved only in this browser (localStorage) unless you sign in with Google to sync it. You can delete it from the Cookie & storage settings page (Japanese).