Domain 1 of 4

Data Preparation for ML and AI

Domain · 28% of the MLA-C02 exam

Data preparation is three stages, and each answers one question

Many model failures are locked in before training starts: one busy partition key overloads the single Amazon Kinesis Data Streams shard (a fixed unit of stream capacity) that the key maps to, a scaler (which learns its minimum and maximum from data) refit on every production batch changes what an input value means, or the same customers land in both training and test data. Data Preparation for ML and AI carries 28% of scored content (the other three domains are 24% each, per the MLA-C02 exam guide) and follows a dataset through three stages that each answer one question: Collect and store asks where each source lands and in what layout, Transform asks what representation the model consumes, and Validate asks whether the data is fit to train on and repairs what is not. Every stage has a traditional ML side and a generative AI side, because vector stores, embeddings and foundation model training datasets pass through the same three stages. The classic trap is picking a feature that does a neighboring stage's job, because one service can serve several stages: an AWS Glue DataBrew profile job computes statistics and can validate DataBrew's own data quality rules (Validate work), while only a recipe job applies the recipe's transformation steps (Transform work).

The domain unfolds in three stages: collect and store, transform, validate

Collect and store data covers the first stage: choosing a copy path (the service or route that copies data into Amazon S3) per source family (file storage, databases and search indexes, event streams), landing an analytical copy in Amazon S3 (the columnar, partitioned copy kept for repeated feature reads), and loading the SageMaker AI Feature Store and the vector stores that serve features and embeddings. Transform data and engineer features covers the second: choosing a transformation engine (the service that runs the preparation, such as AWS Glue DataBrew or SageMaker Data Wrangler, which is now integrated into Amazon SageMaker Canvas), engineering features, embedding and chunking documents for retrieval augmented generation (RAG), masking sensitive data, and shaping foundation model (FM) training data. Validate data quality and manage bias covers the third stage, whose one question (is the data fit to train on?) breaks into three: record validity (is each record, and its label, correct?), population representation (do the groups and classes the model must serve appear, with outcome rates you can defend?), and evaluation independence (does the test data measure examples the model never saw?). The decision tree below sorts a requirement into its stage and, for Validate, into its question.

Settle early the choices later stages cannot undo

When two answers both work, prefer the one that settles a hard-to-change choice up front and reuses it, over one that patches the result later. An Amazon S3 Vectors index cannot change its dimension or distance metric after creation, and an Amazon Bedrock knowledge base data source cannot change its chunking configuration without being re-created. A fitted transformation (one whose parameters are learned from data, like that scaler's) is fit once on the training partition (the training split of the dataset, not a storage or stream partition) and reused unchanged, which a SageMaker AI inference pipeline supports by running containers that reuse the data transformers developed for training in front of the model. In the same way, remove duplicates before you split and augment only the training partition, because copies on both sides of the split make overfitting look like generalization.

The three data preparation stages and where each is covered

StageQuestion it answersTraditional ML examplesGenerative AI examplesDrill into
Collect and storeWhere does each source land, and in what layout?AWS DataSync, AWS Glue connections, Kinesis Data Streams, Amazon Data Firehose (formerly Kinesis Data Firehose), Parquet in Amazon S3, SageMaker AI Feature StoreVector stores: Amazon OpenSearch Service, Amazon RDS for PostgreSQL with pgvector, Amazon S3 VectorsCollect and store data
TransformWhat representation does the model consume?Fitted transformations such as scaling and encoding, and sensitive-data masking, on a transformation engine such as AWS Glue DataBrew, SageMaker Data Wrangler or Amazon Managed Service for Apache FlinkEmbedding models, chunking documents for RAG, FM fine-tuning and distillation datasetsTransform data and engineer features
ValidateIs the data fit to train on? (record validity, population representation, evaluation independence)AWS Glue Data Quality rules, cleaning missing values and outliers, data labeling, splitting into training, validation and test partitions, bias metrics, class imbalance remediesPrompt-response correctness review, and content safety screening with the Amazon Bedrock ApplyGuardrail APIValidate data quality and manage bias

Decision tree

Is the choice where a source lands,or in what layout?Collect and storecopy path, storage layout, feature and vector storesYesNoMust the data representationchange for the model?Transformfitted transformation, transformation engineYesNoValidate: which questiondoes the work answer?Record validityrules, cleaning, labelsPopulation representationbias metrics, class imbalanceEvaluation independenceremove duplicates before the splitEvery stage: settle early the choices later stages cannot undo

Subtopics in this domain