Section: Exam Notes
Section: Exam Notes

Ensuring Data Integrity and Preparing Data for Modeling

This section focuses on ensuring data reliability, security, fairness, and compliance before model training—critical factors for building accurate and trustworthy machine learning solutions.

Domain 1: Data Preparation for Machine Learning
Task Statement 1.3: Ensure data integrity and prepare data for modeling


1. Pre-Training Bias Metrics for Numeric, Text, and Image Data

Bias present in training data can lead to unfair or inaccurate predictions. Identifying bias early helps prevent downstream issues in model behavior. AWS provides Amazon SageMaker Clarify to evaluate bias both before and after model training.

Common bias metrics include class imbalance, which measures uneven class distribution in labeled datasets such as fraud versus non-fraud scenarios. Difference in Proportions of Labels evaluates whether certain demographic groups are disproportionately represented across labels. Mean Prediction Difference measures average output differences between demographic groups and is commonly used in regression fairness analysis. Conditional Demographic Disparity examines prediction disparities while controlling for specific variables, making it especially useful in sensitive domains such as healthcare and image classification.


2. Strategies to Address Class Imbalance

Class imbalance occurs when one category dominates the dataset, often causing models to favor the majority class. Several techniques are used to mitigate this issue.

Oversampling techniques such as SMOTE and ADASYN generate synthetic examples of minority classes and are commonly applied in fraud detection and medical diagnostics. Undersampling reduces the size of the majority class and is effective when data volume is large. Weighted loss functions assign higher penalties to misclassifying minority classes and are widely used in deep learning models. Data augmentation creates new training samples through transformations such as rotation or text paraphrasing, while class weight adjustment allows algorithms such as logistic regression and decision trees to account for imbalance during training.

AWS services that support class balancing include SageMaker Clarify for bias detection, AWS Glue DataBrew for automated resampling workflows, and Amazon SageMaker Feature Store for managing balanced feature datasets.


3. Data Encryption Techniques

Protecting data confidentiality is essential when handling training datasets that contain sensitive information. AWS offers encryption solutions for data both at rest and in transit.

Server-side encryption ensures data is encrypted automatically before storage in services such as Amazon S3, DynamoDB, and Amazon RDS. Client-side encryption encrypts data before it is uploaded to AWS and is typically used for highly sensitive workloads. AWS Key Management Service provides centralized control over encryption keys, while Transparent Data Encryption automatically secures entire database volumes in Amazon RDS. AWS Secrets Manager protects credentials, API keys, and secrets used within ML pipelines.


4. Data Classification, Anonymization, and Masking

Sensitive data must be identified and protected before it is used for model training.

Data classification techniques include detecting personally identifiable information using Amazon Macie and identifying protected health information with Amazon Comprehend Medical. Data residency controls enforced through AWS Organizations help organizations comply with regional data storage regulations.

Anonymization techniques such as tokenization replace sensitive values with non-sensitive placeholders, while data redaction masks specific portions of sensitive data. Pseudonymization substitutes real identifiers with artificial values, preserving analytical usefulness while reducing privacy risk. These techniques are commonly implemented using AWS Glue, AWS Lambda, and Amazon Macie.


5. Compliance and Regulatory Considerations

Machine learning workloads must comply with data privacy and security regulations.

Regulations such as GDPR require strict controls over personal data for EU residents, while HIPAA mandates safeguards for healthcare data. CCPA grants users rights over their personal information, including data deletion, and PCI DSS enforces security standards for payment data. AWS services such as Amazon Macie, AWS Organizations, IAM, RDS encryption, and AWS WAF help organizations meet these regulatory obligations.


6. Validating Data Quality

High-quality data is essential for reliable model outcomes. Validation ensures consistency, completeness, and correctness of training datasets.

Missing values can be detected using AWS Glue Data Quality, while schema consistency checks ensure column data types remain unchanged across pipeline stages. Anomaly detection identifies outliers that may distort training results, and duplicate detection removes redundant records. Tools such as AWS Glue DataBrew and Amazon SageMaker Data Wrangler are commonly used for these validation tasks.


7. Identifying and Mitigating Bias in Data

Bias can arise from non-representative sampling, inconsistent measurement methods, or subjective assumptions embedded in data collection.

Selection bias occurs when datasets fail to represent the full population and is commonly detected using SageMaker Clarify. Measurement bias stems from inconsistent data collection processes, while confirmation bias reflects preconceived assumptions about data patterns. AWS Glue DataBrew and AWS Glue Data Quality help identify and mitigate these issues.

Bias mitigation strategies include dataset augmentation to improve representation, resampling techniques to rebalance classes, and feature engineering to remove or transform biased attributes.


8. Preparing Data to Reduce Prediction Bias

Before training begins, datasets should be structured to minimize bias.

Splitting datasets into fair training and testing subsets prevents evaluation bias, while shuffling data eliminates order-based learning artifacts. Data augmentation improves representation of minority classes, and feature selection removes attributes that may introduce unintended bias into predictions.

AWS services supporting bias reduction include SageMaker Clarify, AWS Glue DataBrew, and Apache Spark on Amazon EMR for large-scale data processing.


9. Configuring Data for Model Training

Efficient storage and access patterns are critical for ML training performance.

Amazon S3 is commonly used for data lakes and unstructured ML datasets. Amazon EFS provides shared file storage for distributed training workloads, while Amazon FSx delivers high-performance, low-latency access for compute-intensive model training.


10. Key Exam Tips

Understand bias metrics such as class imbalance and difference in proportions of labels, and know how SageMaker Clarify detects pre-training bias. Be familiar with AWS encryption options, including S3 server-side encryption, AWS KMS for key management, and Amazon RDS Transparent Data Encryption.

Know how AWS services classify and protect sensitive data, particularly Amazon Macie for PII detection and Amazon Comprehend Medical for PHI. Validate data quality using AWS Glue Data Quality and DataBrew, and optimize storage choices for training workloads using Amazon S3, Amazon EFS, and Amazon FSx.

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Hide picture