Domain 1 of 4 · Chapter 3 of 3

Validate data quality and manage bias

Unlock the complete study guide.

Bundled into the existing AWS Certified Machine Learning Engineer - Associate premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • Data quality and bias checks on a training dataset
  • Choose where data quality checks run
  • Write DQDL rules that state the real requirement
  • Gate the pipeline on a failed check
  • Fill missing values without hiding them
  • Handle outliers according to what they are
  • Find exact and near-duplicate records
  • Choose the Ground Truth task type
  • Choose the Ground Truth workforce
  • Automate labeling with Ground Truth
  • Audit label quality
  • Split data so the test score stays honest
  • Measure data bias with pretraining metrics
  • Trace a disparity to its collection or labeling cause
  • Resolve class imbalance
  • Validate generative AI training data

Data Wrangler split transforms by what the evaluation must prove

CriterionRandomized splitOrdered splitStratified splitSplit by key
What it guaranteesEach split is a random, non-overlapping sampleThe first observations go to training and the last to testing, keeping their orderEach value of the input column keeps about the same proportion in every splitNo value of the key columns appears in more than one split
Use when the evaluation must provePerformance on new, independent rowsPrediction of later events from earlier dataPerformance on every class, including rare onesPerformance on unseen entities such as customers or patients
What it does not doKeep an entity's rows or the time order togetherBalance classes or mix time periodsBalance the classes: it keeps the existing proportionsPreserve class proportions or time order
Constraint to knowCan take longer than an ordered split on large datasetsOrders by dataset sequence or by an optional numeric input columnInput column can have at most 100 unique valuesYou name the key columns whose values must not be shared

Decision tree

Predict later eventsfrom earlier data?Ordered splitYesMust test entities, such aspatients, be unseen?Split by keyNoYesMust every split keepeach class's proportion?Stratified splitNoYesRandomized splitNoAlways: remove duplicates before the split; augment only the training partition

Cheat sheet

  • DQDL checks require supported columns rather than nested or list-valued data
  • Glue Data Quality rules turn data requirements into repeatable checks
  • A valid primary key must be both non-null and unique
  • Referential integrity checks validate keys against a reference dataset
  • A schema-valid dataset can still be too stale for its intended use
  • Aggregate reconciliation can detect missing value even when row counts match
  • Data Wrangler insights identify anomalous samples and dataset quality issues
  • A private Ground Truth work team assigns labeling to selected workers
  • The labeling task must match the prediction's required spatial detail
  • Named entity annotation labels spans rather than whole documents
  • Automated labeling uses human input where automatic confidence is insufficient
  • Label verification assesses annotations while adjustment corrects them
  • Deduplicate source examples before assigning independent dataset splits
  • Split by key keeps related observations from appearing in more than one partition
  • Time-dependent evaluation should preserve the direction from past to future
  • Stratified splitting preserves category representation across partitions
  • Shuffling changes record order without repairing missing population coverage
  • Keep augmented variants of an example out of the validation and test partitions
  • Pretraining bias metrics examine the dataset before predictions exist
  • The Class Imbalance bias metric measures representation of facet groups
  • Balanced group counts do not guarantee equal positive-label proportions
  • Conditional disparity analysis can reveal patterns hidden by aggregate rates
  • Multimodal distribution checks need meaningful labels and group metadata
  • Data bias remediation should correct the collection or annotation process that produced the disparity
  • Oversampling increases minority exposure without removing majority examples
  • Undersampling reduces class dominance by discarding majority examples
  • SMOTE creates synthetic minority examples by interpolating feature vectors
  • Class weighting changes the training penalty without resampling records
  • Image augmentation is valid only when the transformation preserves the target meaning
  • Median imputation limits the influence of extreme observed values
  • Categorical imputation and Fill missing are different choices
  • A missing-value indicator preserves whether a value was originally absent
  • Outliers should be handled according to validity and the model's intended population
  • Outlier detection methods differ in their sensitivity to extreme values
  • Exact-match deduplication does not detect every near-duplicate document
  • Prompt-response validation must check correctness as well as file syntax
  • Training content needs its own safety screening before customization
  • Training integrity includes coverage of realistic requests and edge cases

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. https://docs.aws.amazon.com/prescriptive-guidance/latest/ml-operations-planning/splits-leakage.html
  2. https://docs.aws.amazon.com/aws-certification/latest/machine-learning-engineer-associate-02/machine-learning-engineer-associate-02-domain1.html
  3. https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-availability-change.html
  4. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html
  5. https://docs.aws.amazon.com/glue/latest/dg/glue-data-quality.html
  6. https://docs.aws.amazon.com/databrew/latest/dg/profile.data-quality-rules.html
  7. https://docs.aws.amazon.com/sagemaker/latest/dg/data-wrangler-data-insights.html
  8. https://docs.aws.amazon.com/sagemaker/latest/dg/data-wrangler.html
  9. https://docs.aws.amazon.com/glue/latest/dg/dqdl.html
  10. https://docs.aws.amazon.com/glue/latest/dg/dqdl-rule-types.html
  11. https://docs.aws.amazon.com/glue/latest/dg/dqdl-rule-types-AggregateMatch.html
  12. https://docs.aws.amazon.com/glue/latest/dg/tutorial-data-quality.html
  13. https://docs.aws.amazon.com/sagemaker/latest/dg/data-wrangler-transform.html
  14. https://docs.aws.amazon.com/databrew/latest/dg/recipe-actions.FLAG_OUTLIERS.html
  15. https://docs.aws.amazon.com/glue/latest/dg/machine-learning.html
  16. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-image-classification.html
  17. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-bounding-box.html
  18. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-semantic-segmentation.html
  19. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html
  20. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-management.html
  21. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-private.html
  22. https://docs.aws.amazon.com/sagemaker/latest/dg/sms-verification-data.html
  23. https://docs.aws.amazon.com/wellarchitected/latest/responsible-ai-lens/raidp02-bp03.html
  24. https://aws.amazon.com/what-is/data-augmentation/
  25. https://aws.amazon.com/blogs/machine-learning/detect-fraudulent-transactions-using-machine-learning-with-amazon-sagemaker/
  26. https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html
  27. https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ShuffleConfig.html
  28. https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-measure-data-bias.html
  29. https://docs.aws.amazon.com/sagemaker/latest/dg/xgboost_hyperparameters.html
  30. https://docs.aws.amazon.com/nova/latest/nova2-userguide/nova-data-prep-sft-2.html
  31. https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-independent-api.html