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
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
  • Week 1
    • 1.The ML Lifecycle (from a Specialty Perspective)
    • 2.Data Storage for ML: S3, EFS, FSx for Lustre, and Data Formats
    • 3.Data Ingestion: Kinesis, Glue, Batch vs. Streaming
    • 4.Data Labeling: SageMaker Ground Truth, Active Learning, Label Quality
    • 5.Week 1 Comprehensive Review: ML Overview & Data Engineering 1
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
    • 1.Classification Evaluation Metrics: Accuracy, Precision, Recall, F1, and the Confusion Matrix
    • 2.ROC/AUC and Threshold Tuning: Reading Model Performance from Curves
    • 3.Regression Evaluation Metrics: RMSE, MAE, MAPE, R², and Residual Analysis
    • 4.Model Debugging and Bias: SageMaker Debugger and Clarify
    • 5.Week 9 Comprehensive Review: Evaluation and Debugging
  • Week 10
  • Week 11
  • Week 12
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← MLS-C01/Week 9/Day 5

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

MLS-C01· AssociateWeek 9 · Day 5~29 min read

Day 5 - Week 9 Comprehensive Review: Evaluation and Debugging

📌 Key Takeaways

  • Week 9 is the final stage of Domain 3 (Modeling) — how to answer, with numbers and tools, "is this model really good, and where and how does it go wrong?"
  • One principle runs through it: a metric is a translation of business cost. If FP is expensive, use precision; if FN is expensive, use recall; if the data is imbalanced, drop accuracy and go to F1/PR-AUC.
  • Model comparison and threshold decisions are separate stages. First pick a model that ranks well by AUC, then set the cut that fits the cost afterward.
  • For regression: "big mistakes are fatal = RMSE, outliers are noise = MAE, comparing different scales = MAPE," and read bias, nonlinearity, and heteroscedasticity from residual plots.
  • Tool division: "gradients/loss/overfitting/tensors = Debugger, fairness/groups/SHAP = Clarify"; tuning direction is classification Maximize / error Minimize.

Flow Map: From Evaluation to Debugging

If you have chosen an algorithm (Week 6) and trained and tuned it (Weeks 7-8), what remains is grading and repair. Weaving four days into one flow gives the following.

[Trained model]
   │
   ├─ 1) Decide the metric family by problem type
   │     classification → accuracy/precision/recall/F1, ROC-AUC, PR-AUC
   │     regression     → RMSE/MAE/MAPE/R²
   │
   ├─ 2) Choose metric and threshold by business cost
   │     FN is fatal → recall / threshold ↓
   │     FP is fatal → precision / threshold ↑
   │     imbalanced  → F1, PR-AUC (no accuracy)
   │
   ├─ 3) Analyze the tradeoff with curves
   │     ROC/AUC = discriminative power, model comparison
   │     PR curve = honest under extreme imbalance
   │
   └─ 4) Debugging, bias, and error analysis
         Debugger = the training process (gradients/loss/overfitting)
         Clarify  = bias (group fairness) + SHAP (explanation)
         error analysis = improve starting with the biggest error buckets

Classification Metrics Master Table (Day 1-2)

MetricFormula denominatorWhenRepresentative scenarioBlind spot of this metric
AccuracyTotalBalanced data only, forbidden for imbalancedProblems where classes are close to 5:5Comes out high even by predicting only the majority class
PrecisionTP+FP (predicted positives)When FP cost is highSpam classification (blocking legitimate mail is fatal)Doesn't look at missed positives (FN) at all
RecallTP+FN (actual positives)When FN cost is highDisease/fraud detection (missing is fatal)Becomes 1.0 if you predict everything positive
F1Harmonic meanFP/FN balance, imbalanced dataImbalance with no stated cost asymmetryCan't reflect which side is more expensive
ROC-AUCArea of TPR vs FPRThreshold-independent model comparisonChoosing among several candidate modelsLooks optimistic under extreme imbalance
PR-AUCArea of Precision vs RecallHonest under extreme imbalanceFraud detection with 0.5% positivesAbsolute comparison across models is data-dependent

Threshold and Curves

ItemROC curvePR curve
AxesTPR vs FPRPrecision vs Recall
TN in the denominatorIncluded (in FPR)Not included
StrengthGeneral comparison of model discriminationDoesn't inflate performance under extreme imbalance
When imbalancedFPR looks small thanks to the many negatives, so optimisticHonest because it looks only at the few positives
  • Threshold ↓ → recall ↑, precision ↓ (you miss less, but false alarms increase)
  • Threshold ↑ → precision ↑, recall ↓ (positive only when sure, but more misses)

Where Each Metric Looks on the Confusion Matrix

                 Actual positive   Actual negative
             ┌───────────────┬───────────────┐
Pred. pos.   │      TP       │      FP       │  ← Precision = TP / (TP+FP)
             ├───────────────┼───────────────┤
Pred. neg.   │      FN       │      TN       │
             └───────────────┴───────────────┘
                     ↑
             Recall = TP / (TP+FN)

  Accuracy = (TP+TN) / total   ← if TN dominates, everything is inflated here
  ROC's FPR = FP / (FP+TN)     ← TN in the denominator → looks small under imbalance
  PR curve                     ← doesn't use TN at all → honest

Cost Asymmetry → Metric and Threshold

Business situationMore expensive mistakePriority metricThreshold
Disease-diagnosis screeningFN (missed patient)RecallLower it
Fraudulent-transaction detectionFN (fraud that got through)Recall / PR-AUCLower it
Spam classificationFP (blocked legitimate mail)PrecisionRaise it
Automatic account suspensionFP (unjust suspension)PrecisionRaise it
Cost asymmetry not statedCan't judgeF1Start from the default

⚠️ Trap: If the word "imbalanced" appears in the question, the accuracy option is wrong. In a 0.5% fraud problem, predicting everything as normal still gives 99.5% accuracy.

Regression Metrics Master Table (Day 3)

MetricCharacterCueCaution
MAERobust to outliers, intuitive unitsWhen you want to ignore outliersDoesn't treat large errors specially
RMSESensitive to large errors (squared)Big mistakes are fatal, built-in defaultSwung heavily by a few outliers
MAPEScale-free relative errorComparing items of different scalesBlows up near y=0
R²Explanatory power relative to the meanReporting explanatory power as one numberIf negative, worse than the mean line

Reading Residual Plots

Residual shapeDiagnosisNext step
Random scatterGoodProceed as is
U-shaped curveNonlinearity not capturedReview feature transforms / nonlinear models
Funnel shapeHeteroscedasticityConsider log-transforming the target, weighted regression
Skewed to one sideSystematic biasCheck for missing features or an intercept problem

💡 Concept: The gap between RMSE and MAE is itself information. If the two are similar, errors are spread evenly; if RMSE is much larger, it signals that a few large errors (outlier-like residuals) exist.

Debugging and Bias (Day 4)

KeywordServiceWhat it does
Vanishing/exploding gradients, overfitting, tensor capture, automatic job stopDebuggerWatches training tensors with rules, stops broken jobs
Group fairness, Disparate Impact, pre-/post-training biasClarify (bias)Measures skew in data and predictions across groups
SHAP, feature attribution, prediction explanationClarify (explainability)Global importance + the reason for an individual prediction
Errors concentrated in a specific rangeError analysis (human)Group into buckets, then improve starting with the largest bucket

The single principle running through this week is "a metric is a translation of business cost." Even for the same model, you look at precision if FP is expensive and recall if FN is expensive, and if the data is imbalanced you drop accuracy and go to F1/PR-AUC. In regression too, RMSE if big mistakes are fatal, MAE if outliers are noise. Metric-selection questions almost always reduce to "which mistake is more expensive in this business?"

Metric Selection Decision Tree

What is the problem type?
├─ Regression
│   ├─ Are large errors especially fatal?
│   │     ├─ Yes → RMSE (tuning direction Minimize)
│   │     └─ No ↓
│   ├─ Do you see outliers as noise and want to ignore them? → MAE
│   ├─ Comparing items of different scales together?          → MAPE (watch y=0)
│   └─ Reporting explanatory power as one number?             → R² (negative = worse than the mean)
│
└─ Classification
    ├─ Are the classes severely imbalanced?
    │     ├─ Yes → no accuracy. F1 / PR-AUC
    │     └─ No ↓
    ├─ Is FN more expensive? (missing disease/fraud is fatal)
    │     └─ Yes → recall first + threshold ↓
    ├─ Is FP more expensive? (blocking legitimate users is fatal)
    │     └─ Yes → precision first + threshold ↑
    ├─ Is the cost asymmetry unclear?                    → F1
    └─ Comparing several models independent of threshold? → ROC-AUC
          └─ Then set the operating cut at the expected-cost-minimizing point on the curve

The Most Confusing Comparisons

ComparisonKey difference
Precision vs recallReduce FP / reduce FN
Accuracy vs F1Balanced data / imbalanced data
ROC vs PR curveGeneral / extreme imbalance (no TN in the denominator)
AUC vs threshold selectionModel comparison / deciding the operating cut
RMSE vs MAEEmphasizes large errors / robust to outliers
Positive vs negative R²Better than the mean / worse than the mean
Debugger vs ClarifyHealth of the training process / bias and explanation
Clarify bias vs SHAPGroup fairness / prediction explanation
Classification tuning vs regression tuningMaximize (F1/AUC) / Minimize (RMSE)

Model evaluation and threshold decisions are separate stages. First pick a "well-ranking model" using a threshold-independent metric like AUC, then set the threshold that fits the FP/FN cost afterward. Thanks to this separation, even if the cost structure changes, you only need to adjust the threshold without retraining the model. This is why on the exam it splits into "model comparison = AUC, operating cut = one point on the curve."

Commonly Missed Traps

How you go wrongWhy it's wrongCorrect judgment
Evaluating imbalanced data with accuracyHigh even if only the majority class is rightF1 / PR-AUC / precision and recall together
Trusting only ROC-AUC under extreme imbalanceThe large TN in the FPR denominator makes it optimisticLook at the PR curve as well
Fixing the threshold first, then choosing a modelAn order that ignores the cost structureModel by AUC → threshold decided afterward
Pushing only recall all the way upPredicting everything positive gives 1.0Together with the tradeoff against precision
Finalizing a model on RMSE aloneSwung by a few outliersTogether with the gap to MAE and residual plots
Always blaming the data when R² is lowA negative value means the model is worse than the meanRe-examine the features and the model itself
Maximizing the objective metric for regression tuningSmaller error is betterRMSE is Minimize
Diagnosing a training failure with ClarifyClarify handles bias and explanationGradients and loss are Debugger
Measuring group fairness with DebuggerDebugger handles the training processFairness is a Clarify bias metric

Self-Check Questions

Try to recall the answers in your head.

  1. Why can't you trust 99.5% accuracy when fraud is 0.5%? → Predicting everything normal gives 99.5%; imbalance
  2. When FN, missing a disease, is fatal, what is the priority metric? → Recall
  3. Which curve is more honest than ROC under extreme imbalance? → PR curve (PR-AUC)
  4. If RMSE is much larger than MAE? → Large errors (outlier-like residuals) exist
  5. If R² is negative? → Worse than predicting the mean line
  6. If the residual plot is a U-shaped curve? → Nonlinearity not captured; re-examine features/model
  7. Which service automatically detects vanishing gradients during training? → SageMaker Debugger
  8. Measuring prediction fairness across groups? → SageMaker Clarify (bias metrics)
  9. Explaining the feature contributions of an individual prediction? → Clarify's SHAP values
  10. What is the direction of the objective metric for regression tuning? → Minimize (RMSE, etc.)

Question Cue → Answer Mapping

Question cueAnswer to pickReason
"Classes are imbalanced 95:5"F1 / PR-AUC (the accuracy option is wrong)Accuracy is high even if only the majority class is right
"We must not miss disease/fraud"Recall first, threshold ↓FN cost dominates
"We must not block legitimate users"Precision first, threshold ↑FP cost dominates
"No mention of which mistake is more expensive + imbalanced"F1Harmonic mean of precision and recall
"Compare several candidate models by discriminative power"ROC-AUCRanking quality independent of the threshold
"We need to set the operating threshold"Expected-cost-minimizing point on the curveEvaluation and the cut decision are separate stages
"Big prediction mistakes are fatal"RMSESquaring amplifies large errors
"Many outliers make the metric fluctuate"MAEAbsolute error, so robust to outliers
"Compare stores and items of different scales together"MAPERelative error, so scale-free (watch y=0)
"The model is worse than the mean prediction"Negative R²A state that failed to beat the baseline (the mean)
"Residuals are funnel-shaped"HeteroscedasticityVariance changes with the predicted value
"We want to catch vanishing gradients and overfitting during training"SageMaker DebuggerWatches training tensors with rules
"Report the approval-rate difference between gender groups"Clarify bias metrics (DPPL, DI)Group fairness of predictions
"Explain the reason for this one decision"Clarify SHAP (local)Feature contributions for an individual prediction
"Performance drops sharply only in a specific range"Error analysis → improve starting with the largest bucketFull retraining or random tuning is inefficient
"Direction of the objective metric in Automatic Model Tuning"RMSE = Minimize, F1/AUC = MaximizeErrors small, performance large

From next week (Week 10), we move on to Domain 4 (Machine Learning Implementation and Operations) — the stage of actually deploying, operating, and monitoring models.

📖 Glossary

  • TP / FP / FN / TN: Positives correctly caught / positives wrongly flagged / positives missed / negatives correctly filtered. The raw material of every classification metric.
  • Precision: The share of actual positives among those called positive. "Did we avoid false flags?"
  • Recall: The share of actual positives that were caught. "Did we avoid missing any?"
  • F1 score: The harmonic mean of precision and recall. The score doesn't rise if only one side is high.
  • ROC-AUC: The area under the TPR-FPR curve when all thresholds are swept. The model's ability to rank.
  • PR-AUC: The area under the precision-recall curve. More honest than ROC when negatives overwhelmingly dominate.
  • Threshold: The cut that splits a probability output into positive/negative. Lowering it raises recall; raising it raises precision.
  • MAPE: The average of relative error, the error divided by the actual value. Used for comparing items of different scales, but watch out for y=0.
  • R² (coefficient of determination): A value showing how much better the model is than "guessing the mean." If negative, it means worse than the mean.
  • Residual: Actual value − predicted value. Its pattern reveals structural defects in the model.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

You want to evaluate a model on a churn prediction problem with a 95:5 class imbalance. Which of the following evaluation approaches is the LEAST appropriate?

Question 2

You want to compare several candidate classification models by discriminative power independent of the threshold, and then set the operating threshold separately according to FP/FN costs. What is the correct approach?

Question 3

Comparing two regression models, Model A has similar RMSE and MAE, while Model B has an RMSE much larger than its MAE. What can be inferred from this?

Question 4

Which of the following pairings of SageMaker service and role is INCORRECT?

Question 5

Which is the correct objective metric direction (objective_type) setting in SageMaker Automatic Model Tuning?

PreviousModel Debugging and Bias: SageMaker Debugger and ClarifyWeek 9 · Day 4Next Inference Options: Real-time vs Serverless vs Asynchronous vs Batch TransformWeek 10 · Day 1

Official references

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

On this page

  • Key Takeaways
  • Flow Map: From Evaluation to Debugging
  • Classification Metrics Master Table (Day 1-2)
  • Threshold and Curves
  • Where Each Metric Looks on the Confusion Matrix
  • Cost Asymmetry → Metric and Threshold
  • Regression Metrics Master Table (Day 3)
  • Reading Residual Plots
  • Debugging and Bias (Day 4)
  • Metric Selection Decision Tree
  • The Most Confusing Comparisons
  • Commonly Missed Traps
  • Self-Check Questions
  • Question Cue → Answer Mapping
  • Glossary
  • Practice Questions