Unit 2 of 8 · about 3 hours · explain

Targets, losses, metrics, decision rules and problem framing

The loss and the decision rule decide what the model learns to care about. A perfect score on the wrong target still ships the wrong behavior.

You'll be able to

  • Distinguish the scientific question, prediction target, estimand, action, outcome, loss, metric, and product decision on a worked example.
  • Choose regression, classification, or an unsupervised framing from the decision thresholds, and defend a proxy label with its failure modes.
  • State success metrics separately from evaluation metrics, and keep prediction language associative rather than causal.

Covers

Target, estimand, loss, metric and decision ruleRegression, classification, ranking and unsupervised framingPrediction language versus causal language
1

Read

In this order, only the parts listed

0 of 4 done

  1. Framing: outputs, thresholds, proxies, success metricsGoogle ML Problem Framing - framing an ML problem

    Identify the output you need; Classification; Regression including the video-caching 50/30-view threshold analysis; Proxy labels including the usefulness proxy table; Define the success metrics including success versus evaluation metrics and the clickbait failure paragraph

    Skip Generation. This section uses predictive ML only; generative outputs are out of scope.

  2. Objectives versus metricsRules of Machine Learning - first controls

    Rule 2: First, design and implement metrics; Rule 12: Do not overthink which objective you choose to directly optimize; Rule 13: Choose a simple, observable and attributable metric for your first objective

  3. Framing checklist and task typesHands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2

    Frame the problem, items 4 to 7: supervised/unsupervised and online/offline framing, performance measure, alignment with the business objective, minimum performance

  4. Supervised and unsupervised task vocabularyHands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2

    Exercise Solutions 4, 5, and 8: regression and classification as the two most common supervised tasks, clustering/visualization/dimensionality-reduction/association as unsupervised tasks, spam detection as supervised

2

Focus on

  • Success metrics differ from evaluation metrics. Success is product behavior (feature opened 50 percent more; 20 percent more time on site); evaluation is model arithmetic (accuracy, RMSE, AUC). A better model score that does not move success is not progress.
  • Fixed thresholds call for classification, moving thresholds for regression. For a video with 30 views, predictions 28 and 32 both miss by 2 and get the same loss (squared error 4), yet the 30-view cache cutoff sends them to different caches.
  • Proxy labels substitute for unmeasurable goals (shared OR liked for usefulness). Each candidate in the table carries a stated failure mode: like-prediction misses users who never click like, popularity is not personalized, click prediction maximizes clickbait, watch time favors long videos.
  • Prediction language stays associative: predicts, is associated with. Acting on a prediction can change the outcome, as the clickbait paragraph shows engagement dropping after click-optimized ranking, so causal verbs need an experiment, not a model score.
Common mistakes · 3
  • Calling the objective the metric. The Terminology section separates them: the objective is the one number the algorithm optimizes; metrics are every number you care about. Rule 12 notes they rise together early on, so a lone objective gain later is not proof of system health.
  • Treating a proxy as the goal. Liking, sharing, clicking, and watch time each mismeasure usefulness in a different direction; the table assigns one failure mode per proxy.
  • Writing causal conclusions from predictive wins. A higher click score does not show the ranking causes satisfaction; the clickbait paragraph shows behavior diverging after the intervention.
3

Try it yourself

Closed-book, before checking anything

Closed-book, redo the video-caching arithmetic: truth 30 views with predictions 28 and 32 gives squared error 4 both ways but opposite cache decisions at the 30 boundary. Then state the classification alternative (no-cache, cheap-cache, expensive-cache labels) and when regression stays right (thresholds set and moving in app code).
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Truth is 30 views; model A predicts 28 and model B predicts 32. Which has lower squared error, and which caches correctly at a 30-view cutoff?Answer

    Neither has lower error: both miss by 2, so both have squared error 4. B caches (32 clears 30) while A does not, so equal loss hides opposite decisions.

  2. 2.The team wants useful recommendations but logs only clicks. Name the proxy and two failure modes from the table.Answer

    Proxy: predict click or play. Failures: it maximizes clickbait, and popularity prediction is not personalized; like-prediction separately misses most users who never click like.

  3. 3.What distinguishes the ML objective from a success metric, per Rules 2, 12, 13 and the weather example?Answer

    The objective is the single directly optimized number, kept simple, observable, and attributable (for example clicked). Success is product behavior (feature opened 50 percent more); a strong objective score need not move it.

  4. 4.Why is the claim that the model proves longer videos are more useful a causal overclaim?Answer

    Watch-time prediction favors long videos by construction, per the proxy table. Usefulness needs an experiment or policy comparison; the prediction only associates length with watched time under current exposure.

5

Practice

  • Google ML Problem Framing: Check Your Understanding boxes

    Proxy labels Check Your Understanding (health-app proxy question) and Define the success metrics Check Your Understanding (fashion-firm ideal outcome versus model goal)

    Answer both cold, then map each wrong fashion option to the mismatched ideal outcome, goal, output, or metric.

You're done when

You answer both Check Your Understanding boxes cold and can redo the 28/32 threshold arithmetic without notes.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 3 more in the section
  • Hands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2Aurelien Geron (O'Reilly, 2025) · primary

    Read Chapters 1 and 2 of the book, then run notebooks 01 and 02 and use ml-project-checklist.md for framing, data inspection, test-set creation, preprocessing pipelines, cross-validation, error analysis and persistence. Rebuild the workflow on UCI Bike Sharing with a chronological split and prohibit casual and registered when predicting cnt.

  • Rules of Machine Learning - first controlsGoogle for Developers · support

    Read Rules 1-5 and 8-9. Turn the existing heuristic into a baseline and test the feature path independently of the learner.

  • Google ML Problem Framing - framing an ML problemGoogle for Developers · support

    Read Identify the output you need through Proxy labels and Define the success metrics, including the video-caching threshold analysis, the proxy-issue table, and both Check Your Understanding boxes.

Also in this section

  • scikit-learn - Common pitfalls and pipelinesscikit-learn · required

    Read Common Pitfalls sections on inconsistent preprocessing and leakage, then Pipeline and ColumnTransformer. Seed global scaling, a target-derived feature and a partition duplicate, and make tests reject each defect.

  • scikit-learn - Cross-validation splittersscikit-learn · support

    Use the group-aware and time-aware splitter sections plus GroupKFold and TimeSeriesSplit. Choose from the dependence structure and assert that no prohibited group or future timestamp crosses the boundary.

  • UCI Bike Sharing DatasetUCI Machine Learning Repository · support

    Use hour.csv as the compact integrated dataset. Preserve a raw snapshot and data dictionary, split chronologically, and document why casual and registered are target proxies for cnt.