MLA-C01 Data Preparation for Machine Learning Practice Question
An e-commerce company is building a recommendation system using user interaction data stored in Amazon DynamoDB. The data includes user_id, product_id, timestamp, event_type (click, add_to_cart, purchase), and session_id. The data science team exports the data to Amazon S3 as JSON files. During preprocessing, they discover that the 'event_type' field contains inconsistent values due to logging errors: 'Click', 'click', 'CLICK', and 'clck' all appear. Also, there are duplicate records where the same user_id, product_id, and timestamp appear multiple times with the same event_type. The team wants to use AWS Glue to clean the data for training a sequence-based recommendation model. Which set of actions should they perform?
⚠ Common exam trap
Many exam-takers think grouping by session_id is necessary for sequence modeling, but the question asks for cleaning steps, not feature engineering—duplicate removal and standardization must come first to avoid propagating errors into the sequence aggregation.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use AWS Glue to drop exact duplicate rows (all columns identical). Then apply a mapping function to standardize event_type to a controlled vocabulary (e.g., 'click', 'add_to_cart', 'purchase').
It addresses both data quality issues: first, dropping exact duplicate rows (all columns identical) removes redundant records that would bias the sequence model; second, standardizing event_type to a controlled vocabulary ensures consistent categorical input for ML training. AWS Glue's DynamicFrame with DropDuplicates and Map transformations are the appropriate tools for this ETL task.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use AWS Glue to group records by session_id and aggregate event_types into a list per session. Then apply a mapping function to standardize event_type names.
Why it's wrong here
Grouping by session loses the sequential order of events, which is critical for sequence-based models.
- ✓
Use AWS Glue to drop exact duplicate rows (all columns identical). Then apply a mapping function to standardize event_type to a controlled vocabulary (e.g., 'click', 'add_to_cart', 'purchase').
Why this is correct
Deduplication removes redundant records, and mapping standardizes event_type, both essential for clean sequence data.
- ✗
Use AWS Glue to drop duplicate records based on all columns. Then drop the event_type column and use only numeric features for training.
Why it's wrong here
Dropping event_type removes the core interaction type, which is essential for recommendation.
- ✗
Use AWS Glue to impute event_type with the mode for records with inconsistent values. Then drop duplicate records based on user_id, product_id, and timestamp.
Why it's wrong here
Mode imputation on event_type is not appropriate because it would assign a potentially incorrect event type to many records.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This MLA-C01 question is part of Courseiva's 835-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLA-C01 exam.