MLA-C01 Data Preparation for Machine Learning Practice Question
A machine learning team is processing a large dataset in Amazon SageMaker using a processing job. The data is stored in S3 in CSV format. The team wants to split the data into training, validation, and test sets (70/20/10) while ensuring that the distribution of a categorical feature 'region' is preserved across splits. Which SageMaker SDK method should they use to write the output?
⚠ Common exam trap
Many candidates confuse generic processing methods (like `Processor.run()` or `FrameworkProcessor`) with the specific processor that supports stratified splitting, or they assume `train_test_split` with a random state is sufficient for preserving categorical distributions, ignoring the need for stratification.
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 sagemaker.sklearn.processing.SKLearnProcessor with a script that uses sklearn's StratifiedShuffleSplit
`SKLearnProcessor` allows you to run a custom Python script that uses `sklearn.model_selection.StratifiedShuffleSplit`, which preserves the distribution of the categorical 'region' feature across the training, validation, and test splits. This is the only option that directly supports stratified splitting within a SageMaker processing job, ensuring the 70/20/10 ratio while maintaining class balance.
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 sagemaker.sklearn.processing.SKLearnProcessor with a script that uses sklearn's StratifiedShuffleSplit
Why this is correct
StratifiedShuffleSplit ensures the 'region' distribution is maintained across splits.
- ✗
Use sagemaker.xgboost.processing.XGBoostProcessor with a script that uses random split
Why it's wrong here
Random split does not preserve categorical distribution.
- ✗
Use sagemaker.processing.Processor.run() with a custom script that uses train_test_split
Why it's wrong here
train_test_split without stratification does not preserve distribution.
- ✗
Use sagemaker.processing.FrameworkProcessor with a script that uses pandas.sample
Why it's wrong here
pandas.sample does not support stratified splitting.
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.