CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
  • Week 1
    • 1.The ML Lifecycle and the Role of the ML Engineer
    • 2.ML Problem Types and Evaluation Metric Basics
    • 3.AWS ML Stack at a Glance
    • 4.SageMaker Overview: Studio, Training/Inference, Built-in Algorithms
    • 5.Week 1 Comprehensive Review — ML Fundamentals & AWS Stack
  • Week 2
  • Week 3
    • 1.Feature Engineering: The Art of Turning Data into Numbers a Model Can Read
    • 2.SageMaker Data Wrangler: No-Code Data Preparation
    • 3.SageMaker Feature Store: Managing Features as Assets
    • 4.Data Bias·Quality: Clarify, Class Imbalance Handling, Data Split
    • 5.Week 3 Comprehensive Review — Feature Engineering·Data Quality
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← MLA-C01/Week 3/Day 5

Based on the MLA-C01 exam guide·Report an error

MLA-C01· AssociateWeek 3 · Day 5~31 min read

Day 5 - Week 3 Comprehensive Review — Feature Engineering·Data Quality

📌 Key Takeaways

  • The picture for Week 3 is a transform (Data Wrangler) → manage (Feature Store) → validate (Clarify) pipeline.
  • The four major transformations are scaling, encoding, missing values, and outliers. Algorithm dependency (distance/gradient-based vs. tree-based) decides which one applies.
  • Feature Store has two stores — online (millisecond inference) and offline (S3 training history).
  • With Clarify, you look at pre-training bias (CI·DPL) and post-training explanation (SHAP).
  • The one word that runs through this week is leakage — you must block transformation, synthetic, future, and evaluation leakage alike.

Feature Engineering Pipeline at a Glance

This week covered the process of refining prepared data into a form that models can learn. It is the area where the ML maxim "data over algorithm" shows most clearly.

[raw data (S3)]
        │  ① Transform (Data Wrangler)
        │     Scaling·Encoding·Missing values·Outliers
        v
[Transformed features]
        │  ② Manage (Feature Store)
        │     Online (inference) + Offline (training) stored together
        v
[Feature Group]
        │  ③ Validate (Clarify)
        │     Bias·Imbalance·Explainability analysis
        v
[Validated training dataset] → SageMaker Training

The key point is that these three stages are connected by consistency. Feature Store supplies the transformations defined in Data Wrangler identically to both training and inference, and Clarify vouches for the fairness of that data.

StageToolProblem it solves
TransformData WranglerSlow hand-coding and non-reproducibility
ManageFeature StoreDuplicate feature building, training/serving skew
ValidateClarify + quality techniquesBias, imbalance, leakage

The statistic that data scientists spend 70–80% of their time on feature engineering is not an exaggeration. As Google's "Hidden Technical Debt in Machine Learning Systems" paper emphasizes, in real ML systems the model code is a small part, while data collection, validation, feature extraction, and consistency maintenance account for most of the complexity and the causes of failure. All three tools this week are mechanisms for taming that data-side complexity.

Four Major Feature Engineering Transformations (Day 1)

Here we review again the core transformations that turn raw data into numbers the model can read.

TransformationWhenRepresentative TechniquesDecision Point
ScalingNumeric ranges vary widelyStandardScaler, MinMaxScaler, RobustScalerRequired for distance/gradient-based algorithms, unnecessary for trees
EncodingCategorical (string) columnsOne-Hot, Ordinal, Target encodingOne-Hot if there is no order, Target if cardinality is high
Missing value handlingValues are emptyMean/median/mode imputation, KNN, deletionMedian if outliers exist, add a flag if missingness itself carries meaning
Outlier handlingExtreme values existIQR·Z-score detection, clipping, log transformNever remove them if they are what you are trying to detect

The deciding criterion is algorithm dependency. Distance/gradient-based algorithms (KNN, neural networks, linear regression) require scaling, but tree-based algorithms (XGBoost, Random Forest) are insensitive to scale.

from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
 
# Numeric: standardize, categorical: one-hot — bundle in one transformer
preprocessor = ColumnTransformer([
    ("num", StandardScaler(), ["age", "income"]),
    ("cat", OneHotEncoder(handle_unknown="ignore"), ["region"]),
])
X_train_t = preprocessor.fit_transform(X_train)
X_test_t = preprocessor.transform(X_test)   # test: transform only, no fit — prevents leakage

⚠️ Pitfall: Scalers and encoders are fit only on train, and only transform is applied to test. If you fit on test statistics, test information leaks into training and becomes data leakage. This principle applies equally to resampling such as SMOTE.

Data Wrangler (Day 2)

SageMaker Data Wrangler is a tool for visually importing, transforming, and analyzing data without code. It provides over 300 built-in transformations and a data quality report, and the flow you build can be exported to a Processing Job, Pipeline, or Feature Store.

StageDescription
ImportLoad from S3, Athena, Redshift, Snowflake, Feature Store
TransformApply 300+ built-in transformations (missing values, encoding, scaling, etc.) with clicks
AnalyzeData Quality report, Quick Model, Target Leakage, Bias, multicollinearity
ExportProcessing Job, Feature Store, Pipelines, code, S3

The value of Data Wrangler does not end at "visual exploration" — it lies in exporting those transformations as reproducible code. Transformations hand-coded in a notebook are hard to reproduce at inference time, but a Data Wrangler flow can be exported as a Processing Job, guaranteeing the same transformation in training and inference. It is the bridge between exploration and production.

⚠️ Pitfall: The data you see on screen is a sample. To apply the flow to the full dataset, you must export the flow as a Processing Job and run it.

Feature Store (Day 3)

SageMaker Feature Store is a repository for centrally storing, reusing, and consistently serving features. Two stores are the core.

AspectOnline StoreOffline Store
PurposeReal-time inferenceTraining·batch
LatencyMilliseconds (key-value)High (S3 Parquet)
QueryLatest single record (GetRecord)Full history (Athena)
CostRelatively highCheap

The greatest value is preventing training/serving skew. Training and inference share the same feature definition, which eliminates at the root the problem where the two compute things slightly differently and performance collapses. The Feature Group (Record Identifier + Event Time) is the unit, and Event Time is the basis for point-in-time queries and for preventing future leakage.

# Training: bulk query of the offline store via Athena
query = feature_group.athena_query()
query.run(query_string="SELECT * FROM customer_features WHERE ...",
          output_location="s3://my-bucket/query-results/")
 
# Inference: fetch the latest single record from the online store
record = featurestore_runtime.get_record(
    FeatureGroupName="customer-features",
    RecordIdentifierValueAsString="cust_12345",
)

Clarify and Data Quality (Day 4)

SageMaker Clarify measures bias before and after training (sensitive attribute facet, CI·DPL metrics) and explains the feature contributions to a prediction with SHAP. Adding data quality checks on top completes a trustworthy dataset.

CheckTechniqueOrder to respect
BiasClarify pre/post-training biasLook at it first, before training
ExplainabilitySHAP feature contributionsAfter training
Class imbalanceSMOTE, class weight, under/oversamplingOnly on the training set, after the split
Data splitStratified (imbalance), temporal (time series)Before resampling and transformation
Final evaluationTest setOnly once

The one word that runs through this week is "leakage". Fitting on test is transformation leakage, resampling before the split is synthetic leakage, using future values as features is future leakage, and ignoring Feature Store's Event Time is look-ahead leakage. Every leakage produces the same symptom: "evaluation looks good, but deployment fails". Half of feature engineering and data quality is preventing leakage.

Leakage Types Summarized

Leakage TypeWhen it occursSymptomPrevention
Transformation leakageFitting scaler/encoder on the entire dataOverestimated validation performanceSplit first, fit only on train
Synthetic leakageResampling such as SMOTE before the splitSynthetic samples mixed into the test setOnly on the training set after the split
Target leakageUsing a feature that contains target informationCorrelation of 0.99, useless at deploymentTarget Leakage analysis, domain review
Future leakageUsing values from after the prediction time as featuresGood only in backtestsEvent Time, point-in-time joins
Evaluation leakageRepeatedly tweaking the model using the test setDistorted generalization estimateUse the test set once, at the very end

Week 3 One-Line Checklist

QuestionAnswer
Does XGBoost need scaling?No. Trees compare thresholds, so units don't matter
What if you encode city names as 0/1/2?The model learns an order that doesn't exist. One-Hot is the standard
A column that is 40% missing?Drop it or convert it to a "was missing" flag
Removing outliers in fraud detection?That erases the very signal you want. Preserve them
Which store for millisecond feature lookup?Online store GetRecord
Bulk retrieval for a training dataset?Offline store + Athena
Measuring bias between genders before training?Clarify pre-training bias (CI·DPL)
When is SMOTE applied?After the train/test split, only on the training set
Splitting imbalanced data?Stratified split (stratify)
Splitting time series data?Split in time order. Random splitting is forbidden

Reviewing Week 3 with Scenarios

SituationJudgmentRationale
In KNN, salary dominates the distance calculationApply scalingDistance-based methods are sensitive to units
Wondering whether to scale for XGBoost performanceUnnecessarySplit threshold comparisons are unit-independent
Encoded city names as 0/1/2 and the linear model behaves strangelyReplace with One-HotIt learned a non-existent order
Zip codes have thousands of values, so One-Hot is a burdenTarget/frequency encoding, embeddingsAvoid dimension explosion
Income distribution has a long right taillog1p transformImproves fit for linear models
The area column contains 99999Check the data dictionary, then treat it as missingPossible sentinel value
Fraudulent transactions are flagged as IQR outliersPreserve them, do not removeThe outlier is the signal itself
Design preprocessing visually without codeData WranglerGUI + 300+ transformations
Apply the designed transformation to hundreds of GBExport as a Processing JobThe screen shows only a sample
"Last login date" has abnormally high predictive powerSuspect Target LeakageInformation from the target time is mixed in
The inference server computes features separately and performance dropsUnify definitions with Feature Storetraining/serving skew
Need a user's latest features in real timeOnline store GetRecordMillisecond single-record lookup
Need the full history for a training setOffline store + AthenaBulk history retrieval
Check gender fairness of a loan modelClarify pre-training biasCI·DPL measurement
Must explain why an application was rejectedSHAP feature contributionsExplanation requirement in regulated industries
Want to grow the minority class in 0.2% fraud dataSMOTE only on the training set after the splitPrevent synthetic leakage
About to split time series dataSplit in time orderRandom splitting causes future leakage
Validation accuracy 99% but it collapses in deploymentAudit the whole leakage familyThe common symptom of this week

Linking Transform, Manage, and Validate Together

[raw]
  │  Data Wrangler flow (design)
  │      └─ export → Processing Job (apply to full data)
  v
[features]
  │  Feature Store ingest
  │      ├─ offline → training set (Athena, point-in-time)
  │      └─ online  → inference (GetRecord)
  v
[validation]
  │  Clarify: pre-training bias (CI·DPL) / post-training SHAP
  │  Quality: imbalance handling (after split), stratified·temporal split, test once
  v
[Trustworthy training dataset]

If any single arrow in this picture is broken by hand-coding, reproducibility and consistency collapse together. "Preprocessing that only works in a notebook" will inevitably cause problems at deployment time. On the exam, when you see phrases such as "reproducibly" or "identical in training and inference", the answer points toward export, Feature Store, and Pipelines.

Week 3 in One Sentence

"Fit only on train, split first of all, define features in one place so training and inference read from it together, and measure bias before you build."

PrincipleIf violated
Split first of allTransformation·synthetic leakage
Fit only on trainOverestimated validation performance
Feature definitions in one placetraining/serving skew
Join by Event TimeFuture leakage
Test set only onceDistorted generalization estimate
Measure bias before trainingAutomating and amplifying unfairness
Keep the evaluation set at the production distributionMetrics unrelated to reality

Check Before Moving to Week 4

QuestionWhat you should be able to answer
Which models require scaling?Distance/gradient-based. Tree families do not
How do you handle high-cardinality categories?Target·frequency encoding or embeddings
What is the difference between Feature Store's two stores?Online = millisecond single records, offline = S3 history
When do you measure bias?Both before training (data) and after training (predictions)
What is the first action to prevent leakage?Splitting the data before anything else

Next week (Week 4) we move into full-scale model training, tuning, and evaluation with the data prepared this way.

📖 Glossary

  • Feature engineering: The whole task of converting raw data into numeric representations a model can learn from.
  • ColumnTransformer: A pipeline tool that applies different transformations to numeric and categorical columns at once.
  • handle_unknown="ignore": An encoder option that handles a new category not seen during training as zeros without raising an error.
  • flow: A blueprint in Data Wrangler that fixes the order of transformations. The key to reproducibility.
  • Feature Group: The storage unit of Feature Store. Record Identifier and Event Time are required.
  • Event Time: The time at which a feature value was recorded. The basis for reconstructing past points in time and preventing future leakage.
  • training/serving skew: The phenomenon where feature computation differs between training and inference, so the model silently gets worse.
  • facet (sensitive attribute): A column whose fairness must be examined. The reference axis for Clarify bias analysis.
  • CI / DPL: Bias metrics measuring the imbalance in sample counts between groups / the difference in positive-label proportions between groups.
  • SHAP: An explanation metric computed by fairly distributing each feature's share of contribution to a prediction.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

A data scientist wants to import data from S3 and Athena with almost no coding, visually apply missing-value handling, encoding, and scaling, and export that transformation flow as a reproducible Processing Job. What is the most suitable tool?

Question 2

The training pipeline and the inference server each compute "average purchase amount over the last 30 days," and subtle differences degraded performance. Which service fundamentally prevents this by having both share the same feature definition?

Question 3

When applying StandardScaler to numeric features, what is the correct way to prevent data leakage?

Question 4

Which of the following is correct about the analysis SageMaker Clarify performs before training (pre-training)?

Question 5

Across this week, what is the most appropriate common cause of the problem where "evaluation looks good but performance collapses at deployment"?

PreviousData Bias·Quality: Clarify, Class Imbalance Handling, Data SplitWeek 3 · Day 4Next SageMaker Training Job: Estimator, Input Channels, Instances, SpotWeek 4 · Day 1

Official references

  • MLA-C01 official exam page(opens in a new tab)
  • Amazon Athena documentation(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)
  • Amazon SageMaker AI documentation(opens in a new tab)

On this page

  • Key Takeaways
  • Feature Engineering Pipeline at a Glance
  • Four Major Feature Engineering Transformations (Day 1)
  • Data Wrangler (Day 2)
  • Feature Store (Day 3)
  • Clarify and Data Quality (Day 4)
  • Leakage Types Summarized
  • Week 3 One-Line Checklist
  • Reviewing Week 3 with Scenarios
  • Linking Transform, Manage, and Validate Together
  • Week 3 in One Sentence
  • Check Before Moving to Week 4
  • Glossary
  • Practice Questions