Skip to content
BEST·BOOKS
+ MENU
← Back to Machine Learning Yearning: Technical Strategy for AI Engineers, in the Era of Deep Learning

AI Study Notebook AI-generated

Study Guide: Machine Learning Yearning: Technical Strategy for AI Engineers, in the Era of Deep Learning

Andrew Ng

By Best Books

This AI-generated study guide is a reading aid. The source-backed recommendation record and evidence for this book live on the book page.

Key points Not available Flashcards Not available
On this page

Machine Learning Yearning: Technical Strategy for AI Engineers, in the Era of Deep Learning — Chapter-by-Chapter Outline

Author: Andrew Ng First published: 2018 (draft released incrementally 2016–2018) Edition covered: Final draft release, deeplearning.ai, 2018 (118 pages, 58 chapters, 13 parts). This is the only edition; the book was distributed free as a PDF and was never issued in revised editions.


Central thesis

Machine learning projects fail not because practitioners lack algorithms but because they lack a disciplined, iterative strategy for diagnosing what is wrong and deciding what to fix next. The core claim of the book is that a small set of diagnostic principles — setting up the right dev/test sets and metrics, decomposing error into bias and variance, comparing to human-level performance, and attributing error to pipeline components — can dramatically accelerate progress on any ML project in the deep learning era.

Ng's insight is that most of the ideas needed to navigate an ML project are not taught in machine learning courses, which focus on algorithms. Strategy — which direction to try, what to measure, when to stop — is learned through experience and is rarely written down. This book codifies that experience into short, actionable chapters designed to be shared across an entire team.

How do you make the key choices that determine whether your ML project succeeds or fails?


Chapter 1 — Why Machine Learning Strategy

Central question

Why does having the right strategy matter as much as having the right algorithm?

Main argument

The cat startup thought experiment. Ng opens with a concrete scenario: you are building a cat-recognition startup, and your neural network is not accurate enough. Your team proposes a dozen possible improvements — more data, bigger network, better regularization, different architecture, domain-specific image preprocessing. Each would take weeks or months. If you choose well, you build the leading platform; if you choose poorly, you waste months.

Strategy as a force multiplier. Most ML problems leave diagnostic clues that reveal which improvements will and will not help. Learning to read those clues is the subject of the book. Without a systematic approach, engineers fall back on intuition or simply try whatever is most exciting, which is rarely the most productive thing.

Key ideas

  • A long list of plausible improvements does not tell you which to prioritize; strategy fills that gap.
  • Wrong choices in prioritization can cost months of team effort.
  • The book's goal is to help practitioners recognize diagnostic signals so they can make faster, better decisions.
  • The target audience is engineers and researchers building applied ML systems, not those primarily doing theoretical research.

Key takeaway

The difference between fast and slow ML teams is often not algorithmic sophistication but strategic clarity about what to work on next.


Chapter 2 — How to Use This Book to Help Your Team

Central question

How should this book be used in a team setting?

Main argument

Short chapters as shareable units. Ng explains that chapters are deliberately short — one to two pages — so that a team lead can print out and share just the relevant chapter with teammates who need to understand a specific decision. This design choice makes the book a practical team communication tool, not just a reference.

The superhero framing. Ng frames the reader as a potential "superhero" of their team — someone who understands the strategic principles well enough to guide the team's priorities even when teammates are not yet convinced. The chapters provide concise arguments that can persuade teammates to change direction.

Key ideas

  • Each chapter is self-contained and can be read independently.
  • The book is meant to be distributed within teams, not hoarded by a single reader.
  • Understanding strategy allows a single well-informed person to redirect an entire team's effort.

Key takeaway

Use individual chapters as targeted reading assignments to align your team on specific strategic decisions.


Chapter 3 — Prerequisites and Notation

Central question

What background knowledge does a reader need?

Main argument

The book assumes familiarity with supervised learning — learning a function from labeled training examples (x, y) — and basic neural network concepts. Readers who have completed an introductory ML course (such as Ng's own Coursera MOOC) have sufficient background. No deep mathematical treatment is required; the focus is on practical reasoning.

Key ideas

  • Supervised learning (input x → output y via labeled examples) is the primary context.
  • Neural networks and deep learning are referenced throughout but require only a basic conceptual understanding.
  • Notation: training set, dev set (development set / hold-out set), test set.

Key takeaway

An introductory ML background is sufficient; the book translates that foundation into strategic decision-making.


Chapter 4 — Scale Drives Machine Learning Progress

Central question

Why are deep learning methods succeeding now, after decades of limited impact?

Main argument

Two drivers of the deep learning surge. The two major forces enabling the current wave of ML progress are (1) data availability — people spend more time on digital devices, generating massive labeled datasets — and (2) computational scale — hardware now allows training neural networks large enough to exploit those datasets.

The scaling diagram. Ng presents a conceptual graph: as training set size grows, older algorithms (logistic regression, SVMs) plateau quickly, while large neural networks continue to improve. This means the recipe for state-of-the-art performance is: (i) train a very large neural network and (ii) have a very large training dataset. Both conditions must be met simultaneously.

Implications for strategy. Because both data and model size matter, practitioners must think carefully about how to acquire more data, how to manage data distributions, and how to scale models appropriately. The book that follows develops strategies for each of these concerns.

Key ideas

  • Traditional algorithms plateau with more data; large neural networks generally continue to improve.
  • Data availability and compute scale are the twin engines of modern ML progress.
  • The relationship between dataset size and model size has strategic implications for every project decision.
  • Small datasets still favor hand-engineered features; large datasets favor end-to-end neural network approaches.

Key takeaway

Deep learning succeeds primarily because large models and large datasets reinforce each other; strategy must account for this scaling dynamic.


Chapter 5 — Your Development and Test Sets

Central question

How should you define your dev and test sets, and what distributions should they come from?

Main argument

The mobile cat app failure. Ng illustrates the core principle with a concrete failure: a team trains a cat detector on website images (easily scraped) and tests on a 70/30 split of the same. The classifier achieves good test accuracy but performs poorly on the actual app, whose users upload blurry, low-resolution mobile phone photos.

The key principle: match your target distribution. The dev and test sets should represent the data your system will encounter in production — not whatever data happened to be available for training. The traditional 70/30 random split rule is a relic of the data-scarce era and is dangerous in modern applications where training data and production data come from different sources.

Definitions clarified. Ng defines the three sets precisely:

  • Training set: what the learning algorithm trains on.
  • Dev (development) set: used to tune parameters, select features, and make design decisions; also called the hold-out cross-validation set.
  • Test set: used only for a final unbiased evaluation of system performance, not for any decisions.

Key ideas

  • Dev and test sets direct your team's attention; choose them to reflect your true goal distribution.
  • The 70/30 split heuristic is inappropriate when training and target distributions differ.
  • Getting dev and test sets wrong can mean months of optimization toward the wrong objective.
  • When production data is unavailable, approximate it as well as possible and update sets once the app launches.

Key takeaway

Choose dev and test sets from the distribution you ultimately care about, not from whatever data is easiest to obtain.


Chapter 6 — Your Dev and Test Sets Should Come from the Same Distribution

Central question

Why must the dev set and test set come from the same distribution?

Main argument

The geography split mistake. Suppose you have user data from four countries and assign two countries to the dev set and two to the test set. Your team optimizes for the dev set distribution, then discovers the test set measures something different. This creates diagnostic confusion: is poor test performance due to overfitting the dev set, a harder test set, or a different distribution?

The diagnostic collapse. When dev and test sets are drawn from the same distribution, poor test performance relative to dev performance has one clear cause: overfitting the dev set, which has a clear remedy. Different distributions introduce multiple confounds simultaneously, making it nearly impossible to know what is actually wrong.

The practical rule. Set both dev and test sets from the same target distribution. Violating this wastes team effort and introduces fundamental ambiguity into every subsequent diagnostic procedure.

Key ideas

  • Mismatched dev/test distributions make it impossible to diagnose whether the team is solving the right problem.
  • The team optimizes toward the dev set; if the dev set doesn't represent the test distribution, all that optimization may be wasted.
  • Academic benchmarks sometimes violate this principle for historical reasons; be cautious when comparing against them.

Key takeaway

Dev and test sets must share the same distribution so that optimizing for the dev set genuinely improves performance on what you care about.


Chapter 7 — How Large Do the Dev/Test Sets Need to Be?

Central question

What size should the dev and test sets be in the deep learning era?

Main argument

Dev set sizing. The dev set must be large enough to detect meaningful differences between algorithms. If classifier A achieves 90.0% accuracy and classifier B achieves 90.1%, you need at least several thousand examples to reliably detect a 0.1% difference. A 100-example dev set is too small for most serious applications; 1,000–10,000 is common.

Test set sizing. The test set needs to be large enough to give high confidence in your final system's performance. The old heuristic of 30% of data for testing is inappropriate at scale — on a dataset of one billion examples, a test set of 10,000 examples is enormous in absolute terms and quite sufficient, even though it represents 0.001% of the data.

The era-specific shift. In the big-data era, the fraction of data allocated to dev/test sets has shrunk while the absolute number has grown. There is no value in having an excessively large test set beyond what is needed to evaluate performance reliably.

Key ideas

  • Dev sets of 1,000–10,000 examples are a reasonable range for many applications.
  • The test set size should give high confidence in the final performance estimate, but no more.
  • In the data-scarce era the 30% rule was fine; in the data-rich era, a much smaller fraction suffices.
  • For mature products optimizing for tiny gains (e.g., web advertising), dev sets may need to be much larger than 10,000.

Key takeaway

Size dev and test sets to detect the level of improvement you care about, not to satisfy historical percentage rules.


Chapter 8 — Establish a Single-Number Evaluation Metric for Your Team to Optimize

Central question

Why is a single-number evaluation metric essential, and how do you create one?

Main argument

The precision–recall ambiguity. Having two metrics — precision and recall — makes it impossible to unambiguously rank two classifiers when one is better on precision and the other is better on recall. Without a clear ranking, teams cannot rapidly decide which idea is working.

The F1 solution. Combining precision and recall into a single number (the F1 score = harmonic mean) resolves the ambiguity. The formula is: F1 = 2 / ((1/Precision) + (1/Recall)).

The general principle. For any task with multiple evaluation criteria, define a single combined metric before development begins. Common methods:

  • Average or weighted average across multiple sub-metrics (e.g., accuracy across four geographic markets).
  • F1 score or other standard combinations.
  • Combining into a composite formula suited to the task.

A single metric creates a total ordering over all model variants, enabling rapid iteration.

Key ideas

  • Multiple metrics create ambiguous rankings; a single metric creates an unambiguous ranking.
  • Teams optimize faster when there is one clear target.
  • F1 = 2/((1/Precision)+(1/Recall)) is the standard way to merge precision and recall.
  • Weighted averages across sub-populations (e.g., geographic markets) are another common method.

Key takeaway

Define a single-number evaluation metric before starting development so every experiment has a clear winner.


Chapter 9 — Optimizing and Satisficing Metrics

Central question

What if two important metrics genuinely cannot be combined into a single formula?

Main argument

Accuracy vs. running time. Suppose three classifiers have accuracy 90%/95ms, 92%/95ms, and 95%/1,500ms. It is unnatural to merge accuracy and running time into a single formula with an arbitrary weighting. The solution is to distinguish between the optimizing metric (maximize it) and the satisficing metric (meet a threshold, then ignore it).

The mechanics. Declare that anything running under 100ms is acceptable, and then optimize purely for accuracy. Running time becomes a satisficing metric; accuracy is the optimizing metric.

Wakeword example. For a voice-activated device (like Amazon Echo), you might minimize the false-negative rate (optimizing metric) subject to no more than one false positive per 24 hours of operation (satisficing metric).

The N-criterion rule. When trading off N criteria, consider N−1 of them as satisficing (set a threshold, must be met) and 1 as the optimizing metric (maximize without limit).

Key ideas

  • Not all metrics need to be combined; some can be handled as hard constraints.
  • One optimizing metric + one or more satisficing metrics is often more natural than a composite formula.
  • This framework applies across domains: latency, memory, fairness constraints, and safety constraints can all be satisficing metrics.

Key takeaway

Define one metric to optimize and turn all others into threshold constraints — this often produces a cleaner and more actionable objective than a weighted sum.


Chapter 10 — Having a Dev Set and Metric Speeds Up Iterations

Central question

Why does having a dev set and metric accelerate progress so dramatically?

Main argument

The idea–code–experiment loop. ML development is an iterative cycle: generate an idea, implement it, evaluate it, repeat. Ng emphasizes that the speed of this loop determines the speed of progress. A team that can evaluate each idea in minutes against a dev set can run dozens of experiments per day; a team without this infrastructure runs experiments that take days to evaluate informally.

The cost of no metric. Without a dev set and metric, evaluating a new classifier requires incorporating it into the app and then playing with the app informally for hours. This makes even a 0.1% improvement invisible. Yet much of the progress in a well-functioning ML team comes from accumulating dozens of such small improvements.

Key ideas

  • Fast iteration is one of the most reliable determinants of ML project success.
  • A dev set and metric allow each idea to be evaluated quickly and quantitatively.
  • Without a metric, 0.1% improvements (which accumulate to large gains) are invisible.
  • The dev set acts as a "flight simulator" for the real-world deployment environment.

Key takeaway

A well-chosen dev set and metric is the single most important infrastructure investment you can make at the start of a project.


Chapter 11 — When to Change Dev/Test Sets and Metrics

Central question

When should you revise your dev/test sets or evaluation metric mid-project?

Main argument

Start fast, revise when wrong. Ng recommends setting up dev/test sets and a metric within one week of starting a new project — it is better to have something imperfect than to overthink and delay. But be ready to revise when the metric diverges from your true objective.

Three reasons to change the metric. (1) The actual distribution you care about differs from the dev/test set. If the app reveals users upload more kitten images than expected, update the dev/test set to be representative. (2) You have overfit the dev set. If dev performance is much better than test performance, you have memorized the dev set and need fresh data. (3) The metric measures the wrong thing. If your accuracy metric ranks classifier A above classifier B, but A allows pornographic images through while B does not, the metric is failing to capture the most important product requirement.

The pornographic image example. Even a numerically higher-accuracy classifier is the wrong choice if it violates a critical product constraint. When the metric stops pointing your team in the right direction, change the metric immediately rather than continuing to optimize toward a broken goal.

Key ideas

  • Initial dev/test sets and metrics are hypotheses; revise them as you learn more.
  • Dev set overfitting is a real phenomenon; a separate test set guards against it.
  • If your metric ranks classifiers differently from your intuition about which is actually better, the metric is wrong — fix it.
  • The process of changing a metric should be treated as a normal part of development, not an admission of failure.

Key takeaway

Treat dev/test sets and metrics as living artifacts; change them quickly when they stop pointing toward the right goal.


Chapter 12 — Takeaways: Setting Up Development and Test Sets

Central question

What are the key principles for setting up dev/test sets and metrics?

Main argument

This chapter summarizes Part 1 of the book (Chapters 5–11) as a bulleted checklist:

  • Choose dev and test sets from the distribution you expect in production, even if that differs from the training distribution.
  • Choose dev and test sets from the same distribution.
  • Use a single-number evaluation metric.
  • Combine multiple objectives into a single metric via averaging, F1, or satisficing/optimizing split.
  • Start quickly (within one week for a new project) and revise as needed.
  • Dev sets of 1,000–10,000 are common; test sets should give high confidence in final performance.
  • If any of these choices prove wrong mid-project, change them rapidly.

Key takeaway

The setup decisions in Chapters 5–11 determine the quality of every subsequent experiment; invest a week in getting them right.


Chapter 13 — Build Your First System Quickly, Then Iterate

Central question

How should you begin a new ML project when you don't yet know which direction is most promising?

Main argument

The anti-perfectionism principle. Even experienced ML researchers cannot reliably predict which direction will work best on a new problem before trying it. The correct response to this uncertainty is not exhaustive upfront planning but building a working system as quickly as possible — within a few days — and then using that system to generate diagnostic clues.

The anti-spam example. A team building an email spam filter faces many possible approaches: collect a honeypot training set, develop text features, develop envelope/header features, and more. None of these is obviously best without data. Building a quick baseline — even a crude one — reveals which error categories dominate and which directions are most promising.

The clues metaphor. A basic system produces errors; those errors are clues. The next several chapters teach you how to read those clues.

Key ideas

  • Building quickly and iterating beats planning to build the perfect system from day one.
  • A basic system reveals which approaches are most promising — information unavailable before the system exists.
  • This advice applies to application builders; researchers publishing papers have a different objective and may need to work differently.
  • The value of a quick first system is primarily its diagnostic value, not its immediate performance.

Key takeaway

Build a basic system quickly, then use error analysis to guide iteration — don't try to build the optimal system from the start.


Chapter 14 — Error Analysis: Look at Dev Set Examples to Evaluate Ideas

Central question

How do you estimate the potential value of a proposed improvement before investing weeks in implementing it?

Main argument

The dog-misclassification proposal. Your cat classifier sometimes mistakes dogs for cats. A teammate proposes spending a month incorporating 3rd-party dog-recognition software to fix this. Should you agree?

The ceiling calculation. Before committing, manually examine 100 misclassified dev set examples. Count what fraction involve dogs. If only 5% of errors are dogs, then even a perfect fix for dog errors would reduce your overall error rate by at most 5% — from 10% to 9.5%. If 50% of errors are dogs, the same fix could reduce error from 10% to 5% — a 50% relative reduction. The percentage sets a ceiling on the potential value of the proposed improvement.

Error analysis defined. The process of manually examining misclassified dev set examples to understand the underlying causes is called error analysis. It provides a quick quantitative basis for prioritizing projects.

Two hours can save a month. Manually examining 100 examples takes less than two hours. That two hours of analysis can prevent a month of wasted engineering effort.

Key ideas

  • Error analysis turns vague improvement ideas into upper-bound estimates of potential gain.
  • Manually examine ~100 misclassified dev set examples.
  • The fraction of misclassified examples in a given error category sets the ceiling for improvement from addressing that category.
  • Error analysis is a habit of disciplined engineers, not a distraction from "real" work.

Key takeaway

Before starting any multi-week improvement effort, do a two-hour error analysis to estimate its ceiling value.


Chapter 15 — Evaluating Multiple Ideas in Parallel During Error Analysis

Central question

How do you efficiently evaluate multiple competing improvement directions at once?

Main argument

The spreadsheet method. Rather than analyzing one potential improvement at a time, create a spreadsheet with one row per misclassified dev example and one column per error category (Dog, Great Cat, Blurry, etc.). For each example, check all applicable error categories. Some examples may fall into multiple categories.

Emergent categories. When you look at examples, new categories often suggest themselves. A batch of Instagram-filtered images suggests adding an "Instagram" column. The process is iterative: start looking at examples, notice patterns, add columns, and re-examine earlier examples with fresh eyes.

Reading the results. After examining ~100 examples, the column totals give a rough but useful estimate of how much improvement is available by addressing each error category. Categories that appear in only 8% of errors are lower priority than categories appearing in 61%.

The limits of error analysis. The percentages indicate potential impact, but prioritization also depends on the difficulty of the fix and the expected cost. Error analysis does not produce a formula; it produces information that feeds human judgment.

Key ideas

  • A parallel-column spreadsheet makes error analysis efficient and comprehensive.
  • Categories are not predetermined; they emerge during the analysis.
  • One misclassified example can belong to multiple error categories.
  • Error analysis percentages bound potential improvement but do not fully determine priority.

Key takeaway

Evaluate all plausible improvement directions simultaneously with a structured spreadsheet rather than analyzing them sequentially.


Chapter 16 — Cleaning Up Mislabeled Dev and Test Set Examples

Central question

When should you invest time in fixing mislabeled examples in your dev and test sets?

Main argument

Mislabeled examples as a distinct error category. During error analysis, you may discover that some dev set examples have incorrect ground-truth labels (e.g., a non-cat labeled as a cat by the original human labeler). These "mislabeled" examples add a systematic error to your performance estimates.

When mislabeling is not worth fixing. If your overall error rate is 10% and 0.6% of that error is due to mislabeling (6% of errors), fixing the labels probably isn't worth the effort — there are bigger gains from other error sources.

When mislabeling becomes worth fixing. If you have improved your system to 2% overall error, and 0.6% of that is now due to mislabeled examples (30% of your total errors), then mislabeling is now a large fraction of what is holding you back and is worth fixing.

The symmetry principle. When fixing labels, check both the examples your system got wrong and the ones it got right. A bias is introduced if you only fix labels on misclassified examples, because your system and the original labeler may both have been wrong on some correctly-classified examples as well.

Dev and test sets must stay aligned. Whatever label-fixing process you apply to the dev set, apply the same to the test set, so they remain from the same distribution.

Key ideas

  • Mislabeled examples are just another error category that can be tracked and addressed when large enough.
  • The threshold for fixing labels depends on the fraction of total error they represent, not the absolute number.
  • Fixing labels on misclassified examples only introduces a pro-algorithm bias; fix both sides if you fix any.
  • Label quality matters more as overall error rates decrease.

Key takeaway

Fix mislabeled dev/test examples when they constitute a significant fraction of your remaining error; use a symmetric process to avoid bias.


Chapter 17 — If You Have a Large Dev Set, Split It into Two Subsets, Only One of Which You Look At

Central question

How do you prevent overfitting the dev set during a long error analysis process?

Main argument

The overfitting problem with error analysis. Each time you manually examine dev set errors and design fixes accordingly, you are implicitly optimizing your algorithm toward the specific examples you have seen. Over many cycles, you can "overfit" the portion of the dev set you have examined.

The Eyeball/Blackbox split. Ng proposes splitting a large dev set into two portions:

  • Eyeball dev set: The portion you manually examine (typically ~100–500 misclassified examples for analysis).
  • Blackbox dev set: The portion you only evaluate automatically, never looking at it directly.

The practical split. If your algorithm has 5% error, a 5,000-example Eyeball dev set would produce ~250 errors to examine. The remaining 4,500 examples form the Blackbox dev set.

The diagnostic signal. If performance on the Eyeball dev set improves much faster than on the Blackbox dev set, you have overfit the Eyeball set and should find a new one by moving examples from Blackbox to Eyeball.

Key ideas

  • Manual examination accelerates overfitting; splitting the dev set guards against this.
  • The Eyeball set is for qualitative error analysis; the Blackbox set is for unbiased automatic evaluation.
  • If the Eyeball set improves faster than the Blackbox set, the Eyeball set has been overfit.
  • Between the two, the Eyeball set is more important (for human-solvable problems).

Key takeaway

Split large dev sets into an Eyeball portion (for manual inspection) and a Blackbox portion (for unbiased evaluation) to prevent overfitting to examined examples.


Chapter 18 — How Big Should the Eyeball and Blackbox Dev Sets Be?

Central question

What are the practical sizing guidelines for Eyeball and Blackbox dev sets?

Main argument

Eyeball dev set sizing. The Eyeball set should be large enough to produce a useful number of misclassified examples to examine. Guidelines:

  • 10 errors: too small to draw conclusions.
  • ~20 errors: rough sense of major error sources.
  • ~50 errors: good sense of major error sources.
  • ~100 errors: very good picture; analysis up to 500 errors can be justified.

If your error rate is 5%, you need an Eyeball set of ~2,000 examples to produce ~100 errors. Lower error rates require larger Eyeball sets.

Blackbox dev set sizing. A Blackbox dev set of 1,000–10,000 examples is usually sufficient for hyperparameter tuning and model selection.

When you cannot split. If your overall dev set is small, use the entire dev set as the Eyeball set. You lose the Blackbox protection but gain full analytical insight.

Key ideas

  • The Eyeball set size is determined by the number of errors you need to analyze, not the number of examples.
  • The Blackbox set size is determined by the precision needed for hyperparameter tuning.
  • For very low error rates (< 1%), obtaining enough errors for analysis requires very large Eyeball sets.
  • When data is scarce, the entire dev set becomes the Eyeball set.

Key takeaway

Size the Eyeball set so you get at least ~50 misclassified examples to analyze; size the Blackbox set to 1,000–10,000 for reliable automatic evaluation.


Chapter 19 — Takeaways: Basic Error Analysis

Central question

What are the key principles of the basic error analysis workflow?

Main argument

This chapter summarizes Part 2 (Chapters 13–18) as a checklist:

  • Build a basic system quickly, then use error analysis to guide iteration.
  • Manually examine ~100 misclassified dev examples; count errors by category using a spreadsheet.
  • Split the dev set into Eyeball and Blackbox portions if large enough; use the split to detect Eyeball set overfitting.
  • Size the Eyeball set to produce enough errors to analyze; size the Blackbox set to 1,000–10,000.
  • If the dev set is too small to split, use the whole dev set as the Eyeball set.

Key takeaway

Error analysis on ~100 misclassified examples is the highest-leverage, lowest-cost diagnostic tool available at the start of an ML project.


Chapter 20 — Bias and Variance: The Two Big Sources of Error

Central question

What are the two fundamental sources of ML error, and how do you distinguish between them?

Main argument

The two sources. Every ML system's error can be decomposed into two components:

  • Bias: The algorithm's error rate on the training set, reflecting how well it fits the training data.
  • Variance: How much worse the algorithm performs on the dev set relative to the training set, reflecting how well it generalizes.

A worked example. Suppose your target error is 5%. Your training error is 15% and dev error is 16%. The bias (15%) is large; the variance (16% − 15% = 1%) is small. This is a high-bias, low-variance situation. Adding more training data will not fix the 15% training error — it makes it harder, not easier, to fit.

Why this decomposition matters. Reducing bias requires different techniques than reducing variance. If you misidentify which problem you have, your fix will not work.

Key ideas

  • Bias = training error (informally; more precisely, training error on a very large dataset).
  • Variance = dev error minus training error.
  • High bias → algorithm is underfitting.
  • High variance → algorithm is overfitting.
  • A system can simultaneously have both high bias and high variance.

Key takeaway

Before choosing a fix, determine whether your primary problem is high bias or high variance — they require opposite remedies.


Chapter 21 — Examples of Bias and Variance

Central question

How do concrete error number combinations map to bias/variance diagnoses?

Main argument

Ng walks through four concrete cases:

  1. Training error 1%, Dev error 11%: Bias ~1%, Variance ~10% → high variance (overfitting).
  2. Training error 15%, Dev error 16%: Bias ~15%, Variance ~1% → high bias (underfitting).
  3. Training error 15%, Dev error 30%: Bias ~15%, Variance ~15% → both high bias and high variance.
  4. Training error 0.5%, Dev error 1%: Bias ~0.5%, Variance ~0.5% → low bias, low variance (good performance).

The chapter reinforces that a single pair of training/dev error numbers is sufficient to diagnose the dominant problem.

Key takeaway

Two numbers — training error and dev error — diagnose whether you have high bias, high variance, or both.


Chapter 22 — Comparing to the Optimal Error Rate

Central question

How does the optimal (Bayes) error rate change the interpretation of bias and variance numbers?

Main argument

Avoidable bias. If the optimal error rate (Bayes rate) is 0%, then a training error of 15% represents 15% of avoidable bias. But if the task is inherently difficult — say, transcribing audio so noisy that even humans achieve 14% error — then a training error of 15% represents only 1% of avoidable bias.

The decomposition. Error can now be split into three components:

  • Unavoidable bias (Bayes/optimal error rate): ~14% in the noisy audio example.
  • Avoidable bias (training error minus optimal rate): 15% − 14% = 1%.
  • Variance (dev error minus training error): dev error − training error.

The Bayes rate as a guide. Knowing the optimal error rate is critical for diagnosing whether training error improvements are even worth pursuing. A training error of 15% looks alarming if optimal is 0%, but is nearly optimal if the best possible is 14%.

How to estimate the Bayes rate. For tasks humans do well (image recognition, speech), human performance is a good proxy. For tasks humans do poorly (recommendation systems, stock prediction), estimating the optimal rate is much harder.

Key ideas

  • Avoidable bias = training error − optimal error rate.
  • Only avoidable bias is worth targeting; unavoidable bias is irreducible.
  • Human-level error is a convenient and widely-used proxy for the optimal error rate.
  • The variance component remains: dev error minus training error.

Key takeaway

Decompose your total error into unavoidable bias, avoidable bias, and variance — then focus only on the parts that are reducible.


Chapter 23 — Addressing Bias and Variance

Central question

What is the simplest, most reliable recipe for addressing high bias and high variance?

Main argument

The two-lever rule. The simplest formula:

  • High avoidable bias → increase the size of your model (more layers, more neurons).
  • High variance → add more data to your training set.

These two levers — model size and data size — are the most reliable ways to reduce avoidable bias and variance respectively.

The limits of the simple rule. In practice, increasing model size eventually hits computational limits, and data is finite. At that point, the book transitions to more advanced techniques.

The role of regularization. Increasing model size can in principle increase variance/overfitting. But with well-designed regularization (L2, dropout), you can usually safely increase model size without increasing overfitting. Regularization effectively decouples model size from variance.

Key ideas

  • Bigger model → less bias; more data → less variance. These are the primary levers.
  • Regularization allows you to increase model size without proportionally increasing variance.
  • Model architecture (type of neural network) affects both bias and variance and is harder to optimize systematically than size.

Key takeaway

The default recipe is: high bias → bigger model with regularization; high variance → more data.


Chapter 24 — Bias vs. Variance Tradeoff

Central question

Is the classical bias–variance tradeoff still binding in the deep learning era?

Main argument

The classical tradeoff. Traditional ML wisdom held that reducing bias (larger model) necessarily increases variance, and vice versa. This creates a fundamental tradeoff: you can have low bias or low variance but not both.

The deep learning era loosens the tradeoff. With large neural networks and large datasets, the tradeoff is less binding because:

  • Increasing model size (which reduces bias) combined with good regularization often does not significantly increase variance.
  • Increasing training data (which reduces variance) generally does not affect bias.
  • Good architecture selection can sometimes reduce both simultaneously.

The practical implication. In practice, practitioners can often get improvements on both bias and variance simultaneously by increasing model size and data together, rather than facing a strict zero-sum tradeoff.

Key ideas

  • The classical tradeoff is real but much less acute with large neural networks and large data.
  • Regularization is the key tool that decouples model size from variance.
  • In the modern era, "add more data" is often a free variance reducer that does not hurt bias.

Key takeaway

The bias–variance tradeoff is real but less constraining in deep learning than in classical ML; with regularization and data, you can often reduce both.


Chapter 25 — Techniques for Reducing Avoidable Bias

Central question

What concrete techniques reduce high avoidable bias?

Main argument

When your training error is significantly above the optimal error rate, the following approaches help:

  • Increase model size (more neurons/layers): Allows the model to fit training data better. If this increases variance, add regularization to compensate.
  • Modify input features based on error analysis insights: Create new features that help with specific error categories identified during error analysis. Can help both bias and variance.
  • Reduce or eliminate regularization (L2, L1, dropout): Reducing regularization decreases bias but increases variance — use only if variance is not currently the binding constraint.
  • Modify model architecture: Changing the type of neural network (e.g., switching to a recurrent or convolutional architecture suited to the task) can reduce both bias and variance.

What does not help with bias. Adding more training data is the most tempting response to poor performance, but it does not help with high bias. More data makes the training set harder to fit, which can actually increase training error slightly.

Key ideas

  • More data is the go-to variance fix, not the bias fix.
  • Increasing model size is the primary lever for reducing bias.
  • Error analysis guides which features to add.
  • Reducing regularization is an option when variance is low but bias is high.

Key takeaway

To reduce avoidable bias, increase model capacity or architectural expressiveness — do not default to collecting more data.


Chapter 26 — Error Analysis on the Training Set

Central question

Can the error analysis methodology be applied to the training set as well as the dev set?

Main argument

When training error is high. If your algorithm has high bias — it is not fitting the training set well — error analysis on the training set can reveal why. Ng gives the example of a speech recognition system that performs poorly on the training set. He suggests listening to ~100 training examples the algorithm gets wrong and categorizing them (loud background noise, user spoke quickly, far from microphone, etc.).

The table format applies. The same spreadsheet approach used for dev set error analysis works equally well for training set error analysis.

The human-level sanity check. During training set error analysis, also ask: could a human transcribe these audio clips correctly given only the same input? If even humans cannot make out the speech (e.g., severe background noise), then the algorithm's errors on those examples are unavoidable and may not be worth targeting.

Key ideas

  • Training set error analysis is appropriate when training error is high relative to the optimal rate.
  • The same categorical spreadsheet approach works for training set errors.
  • A human sanity check identifies unavoidable errors and avoids targeting them.
  • Training set error analysis is less commonly performed but valuable when bias is high.

Key takeaway

Apply error analysis to the training set when bias is high; categorize training errors the same way you would dev set errors.


Chapter 27 — Techniques for Reducing Variance

Central question

What concrete techniques reduce high variance?

Main argument

When your dev error is significantly higher than your training error, the following help:

  • Add more training data: The simplest and most reliable variance fix, provided more data is available.
  • Add regularization (L2, L1, dropout): Reduces variance but may increase bias.
  • Early stopping (stop gradient descent based on dev error): Reduces variance but may increase bias; often considered a regularization technique.
  • Feature selection: Reducing the number of features can reduce variance, but may increase bias if important features are dropped. In the deep learning era with abundant data, feature selection is less common because neural networks learn to weight features automatically.
  • Decrease model size: Reduces variance but may increase bias. Ng recommends using regularization instead, reserving model size reduction for cases where computational cost is the primary concern.

Two additional tactics shared with bias reduction:

  • Modify input features based on error analysis insights.
  • Modify model architecture.

Key ideas

  • More data is the most reliable variance reducer and typically does not hurt bias.
  • Regularization reduces variance at the cost of some bias.
  • Feature selection and model size reduction are less preferred in deep learning but useful in data-scarce settings.

Key takeaway

To reduce variance, add data first; add regularization second; reduce model size only as a computational last resort.


Chapter 28 — Diagnosing Bias and Variance: Learning Curves

Central question

How can learning curves reveal whether adding more data will help?

Main argument

Learning curves defined. A learning curve plots dev set error as a function of training set size. You train the same model on 100 examples, 200 examples, 300 examples, and so on, and measure the dev error at each size.

The desired error rate. Superimpose a horizontal line representing your "desired error rate" (often human-level performance). This makes it visually clear how far your current system is from the target.

What plateauing means. If the dev error curve has flattened out and is not approaching the desired rate, adding more data will not get you there. The curve's shape tells you whether the approach is promising.

The limitation. With only the dev error curve, it can be difficult to extrapolate precisely. Adding the training error curve (Chapter 29) makes extrapolation much more reliable.

Key ideas

  • Learning curves plot dev error vs. training set size.
  • A flattening dev error curve suggests more data will not help.
  • Adding a "desired performance" baseline makes the gap visually obvious.
  • Learning curves are expensive to compute (requires training multiple models) but provide high-value diagnostic information.

Key takeaway

Plot a learning curve before committing to a large data collection effort; if the curve has plateaued, more data will not help.


Chapter 29 — Plotting Training Error

Central question

Why should you plot training error alongside dev error on the learning curve?

Main argument

Training error grows with dataset size. As training set size increases, training error generally increases — the model can no longer memorize every example. On a 2-example dataset, any model achieves 0% training error; on a 10,000-example dataset with some noise and ambiguity, perfect training accuracy is impossible.

The two-curve picture. When you add the training error curve to the learning curve plot, you get:

  • A rising blue curve (training error) converging toward the dev error from below.
  • A falling red curve (dev error) converging from above.
  • The gap between them reflects variance.

Why this helps extrapolation. With both curves visible, you can reason more confidently: if both curves have flattened out well above the desired performance line, neither adding data nor reducing the gap will achieve the goal — you have high avoidable bias. If the gap between the two curves is large and the training error is low, adding data may close the gap.

Key ideas

  • Training error increases with dataset size because larger datasets are harder to memorize.
  • Plotting both training and dev error clarifies whether the problem is bias, variance, or both.
  • The gap between the two curves is a visual representation of variance.
  • Both curves together support confident extrapolation about the impact of more data.

Key takeaway

Always plot training error alongside dev error; together they reveal bias, variance, and whether more data will help.


Chapter 30 — Interpreting Learning Curves: High Bias

Central question

What does a high-bias learning curve look like, and what does it imply?

Main argument

The signature. In a high-bias learning curve, both the training error and dev error have flattened out, and both are well above the desired performance level. The gap between the two curves (variance) is small.

The conclusion. When even training error is above the desired level, no amount of additional data will get the model to the desired performance. Adding data makes training harder (training error rises or stays flat), so the training curve cannot reach the desired level. The dev curve, which is always above the training curve, is even further away. Therefore: more data will not fix high bias.

The two-curve test. If training error > desired level and training error ≈ dev error (small gap), you have high avoidable bias. No data intervention will help; you need model improvements.

Key ideas

  • High bias is visually identifiable: both curves are flat and well above the desired level with a small gap between them.
  • Adding data cannot help when training error itself is above the desired level.
  • This visual test is more reliable than looking at just the endpoint numbers.
  • The remedy for this scenario is bias-reducing techniques (larger model, better architecture, reduced regularization).

Key takeaway

A flattened learning curve where even training error exceeds the desired level confirms high avoidable bias; stop collecting data and fix the model instead.


Chapter 31 — Interpreting Learning Curves: Other Cases

Central question

How do learning curves look under high variance and under combined high bias + high variance?

Main argument

High variance signature. Training error is low (close to desired performance), but dev error is much higher. The gap between the two curves is large. Adding more training data will likely help: more data should allow the dev error to converge toward the training error.

Both high bias and high variance. Training error is high (far above desired performance), and dev error is even higher (large gap). The algorithm simultaneously underfits the training set and overfits relative to it. This is the hardest case to fix because it requires both bias-reducing and variance-reducing interventions.

The diagnostic decision tree. After plotting a learning curve:

  • Small gap, both curves above desired → high bias. Fix: bigger model.
  • Large gap, training curve near desired → high variance. Fix: more data or regularization.
  • Large gap, training curve above desired → both. Fix: need to address both simultaneously.

Key ideas

  • High variance: large gap between training and dev curves, training error low.
  • Both high: large gap AND training error is high.
  • Learning curves make the diagnosis visual and unambiguous.

Key takeaway

Read the learning curve shape to determine your dominant problem; a large gap suggests variance, a high floor suggests bias, and both together suggest both problems.


Chapter 32 — Plotting Learning Curves

Central question

How do you handle noise and practical challenges when plotting learning curves?

Main argument

Noise in small training sets. When training on very small subsets (e.g., 10 examples), the training curve can be noisy because a single "bad" batch of examples can dominate. On heavily skewed datasets (e.g., 80% negative examples), randomly sampled small training sets may accidentally contain almost no positive examples.

Smoothing techniques. To reduce noise:

  1. Train multiple models on different random subsets of the same size (sampling with replacement) and average their errors.
  2. For skewed class distributions, stratify your random subsets to maintain the class proportions of the full training set.

Computational cost. Learning curves require training many models at different dataset sizes. To save computation, use a geometric spacing of training set sizes (1,000; 2,000; 4,000; 6,000; 10,000) rather than a linear spacing.

Key ideas

  • Learning curves on small training subsets are noisy; averaging over multiple random subsets reduces noise.
  • Stratified sampling prevents class-imbalance artifacts.
  • Geometric spacing of training sizes reduces the total computation needed.
  • Not every project needs a learning curve; use it when the shape of the curve is uncertain.

Key takeaway

Use averaged runs and stratified subsets to produce clean learning curves; space training sizes geometrically to save computation.


Chapter 33 — Why We Compare to Human-Level Performance

Central question

Why is human-level performance a useful benchmark for ML systems?

Main argument

Three reasons human comparison helps. When an ML task is one humans can do well:

  1. Labeled data from humans. It is straightforward to get human-provided labels, enabling large-scale supervised training.
  2. Error analysis draws on human intuition. A human can often explain why the algorithm got a specific example wrong, providing actionable guidance.
  3. Human performance estimates the optimal error rate. Human-level performance provides an upper bound on the Bayes rate, enabling precise estimates of avoidable bias.

When human comparison fails. For tasks where even humans do poorly — movie recommendation, ad click-through prediction, stock price forecasting — the three benefits above don't apply. You cannot easily get high-quality human labels, human intuition is not a reliable guide, and the Bayes rate is unknown.

The slow-down beyond human level. After an ML system surpasses human performance, progress typically slows because all three tools above become unavailable or less reliable. This is a well-documented empirical observation in speech recognition and image classification.

Key ideas

  • Human-level performance is a pragmatic proxy for the Bayes/optimal error rate.
  • Easy labeling, useful intuition, and a clear target are the three practical benefits.
  • These benefits disappear when humans cannot perform the task well.
  • This chapter implicitly justifies the focus in the next few chapters on human-level comparison.

Key takeaway

Work on problems where humans can perform the task well, because human performance gives you free error analysis tools and a natural performance target.


Chapter 34 — How to Define Human-Level Performance

Central question

Which human performance level is the right target when different humans have different capabilities?

Main argument

The medical imaging example. Consider a medical imaging AI. Performance levels:

  • Untrained person: 15% error.
  • Junior doctor: 10% error.
  • Experienced doctor: 5% error.
  • Small team of doctors debating each image: 2% error.

The right choice. Ng recommends using the best available human performance (here, 2%) as the human-level benchmark — for three reasons: (1) it is achievable (someone achieves it), (2) it is the best proxy for the Bayes rate, and (3) it gives the most ambitious target for avoidable bias estimation.

A practical nuance. Obtaining the 2% benchmark (a team of doctors) is expensive. In practice, you might use junior doctors for most labeling and only escalate hard cases to the team. If your system is at 40% error, using 5% vs. 10% as the benchmark barely matters. But if your system is at 10% error and approaching human level, using 2% as the benchmark reveals important remaining avoidable bias that the 10% baseline would obscure.

Key ideas

  • Use the best available human performance as your human-level benchmark, not the average human.
  • The best human performance is the tightest lower bound on the Bayes rate.
  • As your system approaches human level, the choice of which human benchmark to use becomes more consequential.
  • Expensive expert labels are worth obtaining when your system is close to that expert level.

Key takeaway

Use the best achievable human performance (not the average) as your human-level benchmark; this gives the tightest estimate of unavoidable bias.


Chapter 35 — Surpassing Human-Level Performance

Central question

What tools remain available once a system has surpassed average human performance?

Main argument

The partial surpassing scenario. Even if your overall system surpasses average human performance, there are usually subsets of data where humans are significantly better — for example, a speech system may surpass humans on average but struggle with rapidly spoken speech. For those subsets, all three human-comparison tools (labeling, intuition, avoidable bias estimation) remain applicable.

Diminishing returns after surpassing. Progress typically slows after a system surpasses human-level performance in aggregate because:

  • Getting high-quality labels is harder (human labels are less reliable than the system).
  • Human intuition is less useful (humans cannot explain why an incorrect input was misclassified if they would have gotten it wrong too).
  • The optimal error rate is now unknown and may be much lower than human performance.

Machines beyond humans. In domains like movie recommendation, loan approval, and delivery time prediction, machines already outperform humans. Progress in these domains is driven differently — primarily by data and feature engineering — not by human-comparison strategies.

Key ideas

  • Surpassing humans in aggregate does not mean all error is unavoidable; subsets may still offer improvement.
  • Human comparison tools apply wherever humans are better than the algorithm on a subset.
  • Beyond human level, progress slows because key diagnostic tools become unavailable.
  • Some tasks have always been beyond human-level for machines; these require different diagnostic approaches.

Key takeaway

Even after surpassing human-level performance overall, look for subsets where humans are better and continue applying human-comparison analysis there.


Chapter 36 — When You Should Train and Test on Different Distributions

Central question

When is it acceptable — or even necessary — to use training data that comes from a different distribution than the dev/test sets?

Main argument

The user-uploaded vs. internet data scenario. Your app has 10,000 user-uploaded cat images (your target distribution), and you can supplement with 200,000 internet cat images (a different distribution). One option is to pool all 210,000 examples and split randomly — but this means ~97.6% of your dev/test data comes from internet images, not your target. Ng recommends against this.

The recommended strategy. Put the 10,000 user-uploaded images into dev/test sets (or mostly there), and use the 200,000 internet images plus some user images in training. This means training and dev/test sets come from different distributions — which creates new challenges (Chapters 40–43) — but ensures the dev/test sets reflect what you actually care about optimizing.

The speech recognition version. Similarly: 500,000 general-topic audio clips available, but only 20,000 street-address clips (your target). Put 10,000 street-address clips in dev/test; use the rest for training.

The underlying principle. In the big-data era, you almost always want to include more data in training even if it is off-distribution, because the information value of additional data typically outweighs the distribution mismatch cost when the model is large enough.

Key ideas

  • Use all available data for training even if it is off-distribution, rather than discarding it.
  • Keep dev/test sets on-distribution (reflective of your actual target).
  • Training on a different distribution from dev/test creates new diagnostic challenges covered in later chapters.
  • The old academic assumption that all data comes from one distribution is increasingly unrealistic in practice.

Key takeaway

In the data-rich era, use off-distribution data in training; but always keep dev/test sets on the distribution you actually care about.


Chapter 37 — How to Decide Whether to Use All Your Data

Central question

Should you ever discard available training data?

Main argument

The scanned documents example. Suppose your dev/test set consists of casual photos of people and animals. You also have a collection of scanned historical documents — completely unlike your target distribution and containing no relevant content. Including these in training provides essentially no benefit (since no knowledge transfers) and wastes computational capacity.

The general test. Include additional data in training if there is a plausible function that works well on both the additional data and the target distribution. Internet cat images and mobile cat images both have cats; a function that recognizes cats in internet images will also tend to recognize cats in mobile images. Scanned historical documents do not share this property with casual photos.

The Sherlock Holmes analogy. Ng quotes Holmes: "The brain is like an attic — for every addition of knowledge, you forget something that you knew before." A big enough neural network (a "big enough attic") can learn from both internet images and mobile images without the two types of data competing for capacity. If the network is too small, the off-distribution data "crowds out" the target-distribution knowledge.

Key ideas

  • Include additional training data unless it actively misleads the model (inconsistent mapping from input to label).
  • A large neural network has sufficient capacity to learn from diverse data without losing target-distribution knowledge.
  • Data that is completely irrelevant to the target distribution wastes computation but rarely actively hurts a large model.
  • The decision depends on whether there exists a single function that works well on both distributions.

Key takeaway

Include all additional training data unless it is truly irrelevant to or inconsistent with your target distribution; a large enough model can handle diversity without degradation.


Chapter 38 — How to Decide Whether to Include Inconsistent Data

Central question

When does additional training data with a different label distribution actively harm performance?

Main argument

The New York vs. Detroit housing example. If you are predicting housing prices in New York City, adding Detroit housing prices to your training set will hurt performance — the same square footage (input x) maps to very different prices (output y) in the two cities. The mapping from x to y is inconsistent across the two datasets.

The key test. Is there a single consistent function f(x) that maps the input x to the correct output y for both datasets? If yes (like internet and mobile cat images), include both. If no (like New York and Detroit housing prices), don't.

The contrast with cat images. A picture of a cat looks like a cat regardless of whether the photo was taken on a mobile phone or scraped from the internet. The label "contains cat" is consistent. So the two datasets are compatible. For housing prices, the label "price" is inconsistent with the input "square footage" depending on location — so including Detroit prices when optimizing for New York is harmful.

Key ideas

  • Inconsistency means: same input x → different correct output y depending on the data source.
  • Inconsistent data actively misleads the model and should be excluded.
  • A technical workaround: add the source as an input feature, making the mapping consistent (but rarely done in practice).

Key takeaway

Exclude training data that is inconsistent — where the same inputs map to different correct outputs depending on the source.


Chapter 39 — Weighting Data

Central question

When you must use a mixture of on-distribution and off-distribution data, how do you manage the imbalance?

Main argument

The 40:1 imbalance problem. If you have 5,000 mobile app images (your target) and 200,000 internet images, the model may effectively learn mostly about internet images because they dominate training. This is computationally wasteful if your actual goal is mobile image performance.

Data weighting. Instead of optimizing equally over all examples, assign a weight β to internet images: the loss becomes:

Σ (mobile) loss(yi, ŷi) + β Σ (internet) loss(yi, ŷi)

Setting β = 1/40 makes the 200,000 internet images contribute equally to the optimization as the 5,000 mobile images, even though there are 40× more internet images.

When weighting is necessary. Weighting is mainly needed when: (1) the additional data comes from a very different distribution than dev/test, or (2) the additional data vastly outnumbers the target-distribution data.

Key ideas

  • Data weighting allows a model to be trained on imbalanced datasets without the larger source dominating.
  • β = (size of target data) / (size of off-distribution data) is the equal-weighting choice.
  • Weighting can be tuned as a hyperparameter on the dev set.
  • Large enough neural networks with sufficient computation may not need weighting because they can learn from all examples at full weight without target-distribution degradation.

Key takeaway

When off-distribution data vastly outnumbers target-distribution data, weight down the off-distribution examples to prevent them from dominating the optimization.


Chapter 40 — Generalizing from the Training Set to the Dev Set

Central question

How do you diagnose which specific failure mode is causing poor dev set performance when training and dev distributions differ?

Main argument

Three failure modes. When your system performs poorly on the dev set, with different training and dev distributions, there are three distinct causes:

  1. High avoidable bias on the training distribution.
  2. High variance (performs well on training, poorly on new training-distribution data).
  3. Data mismatch (generalizes well to new training-distribution data, but not to the dev distribution).

The Training Dev Set. To distinguish these three, introduce a fourth dataset: the training dev set — drawn from the same distribution as the training set, but not trained on. Comparing performance across four sets (training, training dev, dev, test) enables precise diagnosis:

  • Training error vs. Training dev error: measures variance.
  • Training dev error vs. Dev error: measures data mismatch.
  • Training error vs. desired performance: measures avoidable bias.

Key ideas

  • Data mismatch is a failure mode that did not exist when all data came from the same distribution.
  • The training dev set is the key diagnostic tool for disentangling variance from data mismatch.
  • All four dataset types (training, training dev, dev, test) have distinct roles and should be tracked separately.

Key takeaway

Create a training dev set (from the training distribution but held out from training) to separate variance errors from data mismatch errors.


Chapter 41 — Identifying Bias, Variance, and Data Mismatch Errors

Central question

How do you read the four error numbers to diagnose which failure modes are present?

Main argument

The 2×3 diagnostic table. Ng presents a conceptual table with axes:

  • X-axis: data distribution (training-distribution data vs. dev-distribution data).
  • Y-axis: relationship to training (human level, trained on, not trained on).

Filling in the cells (human error on each distribution, training error on each distribution, training dev / dev error on each distribution) reveals which failure modes are active.

Worked examples:

  • Training 1%, Training dev 5%, Dev 5%: high variance (1%→5% when going from trained to untrained training data; mismatch is zero since training dev and dev are equal).
  • Training 10%, Training dev 11%, Dev 12%: high avoidable bias (training 10% vs. ~0% optimal).
  • Training 10%, Training dev 11%, Dev 20%: high avoidable bias (10% training) + data mismatch (11%→20% when going from training dev to dev).

Key ideas

  • The jump from training error to training dev error measures variance.
  • The jump from training dev error to dev error measures data mismatch.
  • The gap between training error and optimal error rate measures avoidable bias.
  • All three failure modes can coexist.

Key takeaway

Use the 2×3 error table to precisely diagnose avoidable bias, variance, and data mismatch from four sets of error numbers.


Chapter 42 — Addressing Data Mismatch

Central question

What can you do to fix a data mismatch problem?

Main argument

The two steps. When data mismatch is identified, Ng recommends:

  1. Understand what properties of the data differ between training and dev distributions.
  2. Find or synthesize more training data that better matches the dev set distribution.

The car noise example. Suppose error analysis on the dev set reveals the system struggles with speech recorded inside a car. The training set has mostly quiet-room audio. The fix: obtain more car-audio training data. Error analysis identifies the specific property that distinguishes training and dev distributions.

The challenge. There is no guaranteed solution. If you cannot obtain training data that better matches the dev distribution, there may be no clear path forward. The field of "domain adaptation" offers theoretical approaches but has limited practical application compared to simply collecting better-matched data.

Key ideas

  • Error analysis on the dev set identifies the specific distributional differences causing mismatch.
  • The primary remedy is collecting more training data that matches the dev distribution.
  • Domain adaptation techniques exist but are of limited practical value in most settings.
  • Understanding the mismatch properties before collecting new data prevents collecting the wrong data.

Key takeaway

Fix data mismatch by first understanding the specific distributional differences via error analysis, then obtaining training data that covers those differences.


Chapter 43 — Artificial Data Synthesis

Central question

Can you synthesize training data to bridge a data mismatch gap when real data is unavailable?

Main argument

The car noise synthesis. If you have 1,000 hours of quiet-room speech data and need car-noise speech, you can download car noise audio from the internet and mix it with the quiet-room recordings. The resulting audio sounds realistic and provides training examples for the car-noise scenario.

The motion blur synthesis. If your dev set has blurry mobile phone photos but your training set has sharp internet images, you can apply simulated motion blur to training images to close the distributional gap.

The core risk: synthetic overfitting. If your 1,000-hour speech dataset is mixed with only 1 hour of car noise, the same 1 hour of car noise repeats 1,000 times. The model may overfit to that specific car noise rather than learning to generalize to all car noise. Similarly, using only 20 synthesized car models from a video game (vs. the full diversity of real-world cars) causes the model to overfit to those 20 designs.

The 1-hour repetition trap. Human listeners likely cannot distinguish a 1-hour loop of car noise repeated 1,000 times from 1,000 genuinely unique hours. But a neural network can detect subtle statistical regularities and overfit to them. This makes synthetic overfitting a "silent" failure mode.

Key ideas

  • Artificial data synthesis can dramatically expand training set size when real data is scarce.
  • The primary risk is overfitting to a limited set of synthesized conditions (car noise, car models, lighting conditions).
  • The number of unique synthesis conditions (not the total hours/images) determines the diversity of the synthetic set.
  • Getting synthesis right can unlock massive improvements; getting it wrong creates models that fail silently on real data.

Key takeaway

Artificial data synthesis is powerful but requires ensuring that the synthesized data covers sufficient variety; limited synthesis conditions produce an overfitted model.


Chapter 44 — The Optimization Verification Test

Central question

When a complex ML pipeline fails, how do you determine whether the problem is in the search/optimization algorithm or the scoring function?

Main argument

The speech transcription structure. Many ML systems follow a pattern: the system learns a scoring function Score_A(S) that estimates the quality of output S given input A, and then uses an approximate search algorithm (e.g., beam search) to find the highest-scoring output.

The two failure modes. When the system outputs the wrong answer S_out instead of the correct answer S*:

  1. Search algorithm failure: The search algorithm failed to find the S that maximizes ScoreA(S). ScoreA(S*) > ScoreA(Sout) but the algorithm picked S_out anyway.
  2. Scoring function failure: The scoring function itself is wrong. ScoreA(S*) ≤ ScoreA(S_out), meaning the model incorrectly rates the wrong answer higher.

The test. Compare ScoreA(S*) and ScoreA(S_out):

  • If ScoreA(S*) > ScoreA(S_out): the scoring function is correct, but the search algorithm failed to find the best output. Fix the search algorithm (e.g., increase beam width).
  • If ScoreA(S*) ≤ ScoreA(S_out): the scoring function is assigning a higher score to the wrong answer. Fix the scoring function (the learning algorithm).

Applying to the full dev set. For each error in the dev set, classify it as a search error or a scoring function error. If 95% of errors are scoring function errors, improving the search algorithm can help at most 5% of errors — not worth prioritizing.

Key ideas

  • Many inference algorithms decouple "learn a score" from "search for the best score."
  • The Optimization Verification test quickly identifies which component is responsible for errors.
  • Beam search width, greedy decoding, and other search strategies can all be tested with this method.
  • This test applies wherever approximate search over a learned scoring function is used.

Key takeaway

When an ML pipeline uses a learned scoring function plus approximate search, use the Optimization Verification test to determine whether to improve the scoring function or the search algorithm.


Chapter 45 — General Form of Optimization Verification Test

Central question

How does the Optimization Verification test generalize beyond speech recognition?

Main argument

The general pattern. The Optimization Verification test applies whenever:

  1. You can compute Score_x(y) indicating how good output y is given input x.
  2. You use an approximate algorithm to find arg maxy Scorex(y).
  3. You suspect the approximation is sometimes finding the wrong maximum.

The machine translation example. Translating Chinese sentence C to English: the scoring function is ScoreC(E) = P(E|C), estimated by the translation model. The search algorithm finds the most likely English translation. If the system outputs a wrong translation Eout instead of the correct E, compute Score_C(E) vs. ScoreC(Eout). If the correct translation scores higher (ScoreC(E*) > ScoreC(E_out)), the search algorithm failed; otherwise, the scoring function failed.

The design pattern. This "score-then-search" pattern is extremely common in AI: object detection (score each bounding box), parsing, sequence generation, image captioning, question answering. Recognizing the pattern makes the Optimization Verification test broadly applicable.

Key ideas

  • The "score-then-search" design pattern appears in many AI tasks beyond speech recognition.
  • The same two-case analysis applies to all of them.
  • The test requires access to the model's internal scoring function, which is usually available.
  • Each dev set error can be attributed to search failure or scoring failure, allowing aggregate statistics.

Key takeaway

The Optimization Verification test is a broadly applicable pattern for debugging any system where a learned scoring function is combined with approximate search.


Chapter 46 — Reinforcement Learning Example

Central question

How does the Optimization Verification test apply to reinforcement learning systems?

Main argument

The helicopter autorotation task. Ng describes a helicopter autorotation (landing with engine off), a complex maneuver. The RL system must: (1) define a reward function R(T) that scores trajectories T, and (2) use an RL algorithm to find the trajectory that maximizes R(T).

Two failure modes in RL. When the RL-controlled helicopter performs worse than a human pilot:

  1. Reinforcement learning algorithm failure: The RL algorithm is not finding the trajectory that maximizes R(T). R(Thuman) > R(Tout) but the algorithm chose T_out.
  2. Reward function failure: R(Thuman) ≤ R(Tout), meaning the reward function incorrectly rates the algorithm's trajectory as better than the human pilot's.

The test. Compute R(Thuman) and R(Tout). If R(Thuman) > R(Tout), the problem is the RL algorithm; work on improving it. If R(Thuman) ≤ R(Tout), the reward function is poorly designed; redesign R.

RL as a special case. The RL framework is a special case of score-then-search: the scoring function is the reward function R(T), and the search algorithm is the RL policy optimization. The Optimization Verification test applies directly.

Key ideas

  • Reward function design is as important as RL algorithm quality and is equally prone to failure.
  • The Optimization Verification test separates RL algorithm failures from reward function failures.
  • T_human is a useful y* even if it is not the mathematically optimal trajectory.
  • This chapter generalizes Chapter 44 to the RL setting.

Key takeaway

In reinforcement learning, use the Optimization Verification test by comparing R(Thuman) and R(Talgorithm) to determine whether to fix the RL algorithm or the reward function.


Chapter 47 — The Rise of End-to-End Learning

Central question

What is end-to-end learning, and why has it become prominent?

Main argument

The sentiment classification pipeline vs. end-to-end. Traditional NLP sentiment analysis used a pipeline: (1) a parser annotates text (tagging adjectives, nouns, etc.), and (2) a sentiment classifier reads the annotated text to produce a positive/negative label. Each component was engineered separately.

End-to-end learning. An end-to-end system takes the raw text "This is a great mop!" and directly outputs a sentiment label, with no intermediate annotation step. A single neural network learns the entire mapping.

Why it works now. With abundant data, end-to-end systems can outperform hand-engineered pipelines because the neural network can learn intermediate representations that are better suited to the final task than the hand-designed intermediate features.

The caveat. End-to-end systems are not always better. They require large amounts of labeled data mapping input directly to output — data that is not always available. The next chapters develop the pros, cons, and guidelines.

Key ideas

  • End-to-end learning replaces manually designed multi-step pipelines with a single neural network.
  • "End-to-end" refers to learning from raw inputs directly to final outputs.
  • With large labeled datasets, end-to-end systems have achieved remarkable results in speech, translation, and image processing.
  • Without sufficient data, end-to-end systems underperform pipelines that embed human domain knowledge.

Key takeaway

End-to-end learning succeeds when labeled data mapping input to output is abundant; it fails when data is scarce and domain knowledge in intermediate steps would help.


Chapter 48 — More End-to-End Learning Examples

Central question

How does the end-to-end vs. pipeline trade-off manifest across different task domains?

Main argument

Speech recognition pipeline vs. end-to-end. The classic pipeline: (1) extract MFCC features, (2) recognize phonemes, (3) string phonemes into words. Each step embeds linguistic knowledge. An end-to-end system takes raw audio directly to transcript. Modern end-to-end systems (e.g., DeepSpeech) outperform the pipeline approach when given enough data.

Autonomous driving. A pipeline approach: (1) detect cars, (2) detect pedestrians, (3) plan a path. An end-to-end approach: take camera images, output steering direction directly. Ng expresses skepticism about end-to-end autonomous driving because the labeled data needed (images → steering) is extremely expensive to collect, while labeled data for intermediate tasks (images → object locations) is abundant.

Complex pipelines. Some pipelines are not linear; they process multiple input streams (cameras, lidar, radar) through parallel modules that feed into path planning. End-to-end learning in this setting is even more data-hungry.

Key ideas

  • End-to-end has succeeded in speech recognition and machine translation where paired (input, output) data is plentiful.
  • Autonomous driving is an example where end-to-end is difficult because the required (image, steering) data is scarce.
  • Pipeline components benefit from abundant labeled data at the intermediate level (car detectors, pedestrian detectors).
  • The choice between pipeline and end-to-end depends heavily on which type of labeled data is available.

Key takeaway

Compare the availability of labeled data for intermediate pipeline stages versus end-to-end (input, output) pairs; choose the approach with better data coverage.


Chapter 49 — Pros and Cons of End-to-End Learning

Central question

What are the systematic advantages and disadvantages of end-to-end learning?

Main argument

Disadvantages of end-to-end (advantages of pipelines). Hand-engineered pipeline components encode valuable domain knowledge:

  • MFCC features capture speech content robustly while discarding irrelevant properties like pitch.
  • Phonemes provide a structured representation that helps the learning algorithm understand basic sound units.
  • This domain knowledge "supplements" the algorithm's learned knowledge, enabling good performance with less data.
  • End-to-end systems must learn all this knowledge from scratch from raw data.

Advantages of end-to-end. End-to-end systems avoid the ceiling imposed by hand-engineering:

  • MFCC features throw away information — if that information matters for the task, the pipeline is permanently limited.
  • Phonemes are a simplification — a model that can learn richer representations may outperform phoneme-based approaches.
  • With sufficient data, end-to-end systems can discover better intermediate representations than humans would design.

The data threshold. With small data, pipeline > end-to-end because human knowledge fills the gap. With large data, end-to-end ≥ pipeline because the model can learn better representations than hand-engineered ones.

Key ideas

  • Pipeline advantages: domain knowledge, lower data requirements, interpretability of intermediate stages.
  • End-to-end advantages: no ceiling from hand-engineering, can discover superior intermediate representations.
  • The threshold depends on both the task and the available data.
  • If you choose a pipeline, the next chapters help you design it well.

Key takeaway

Use end-to-end when you have abundant end-to-end labeled data; use a pipeline when data is scarce and domain knowledge in intermediate stages is valuable.


Chapter 50 — Choosing Pipeline Components: Data Availability

Central question

When designing a pipeline, what is the most important factor in choosing which components to include?

Main argument

The autonomous driving example. A car detection module and a pedestrian detection module each benefit from large publicly available labeled datasets (ImageNet-scale datasets with bounding boxes around cars and pedestrians). Training a car detector is straightforward. An end-to-end (image → steering) system requires data from people actually driving instrumented cars — expensive and slow to collect.

The data-availability principle. When designing a pipeline, prefer decompositions that align pipeline components with tasks for which abundant training data already exists. This makes each component trainable and high-quality.

The mismatch between data and task. End-to-end data (input → final output) is often harder to collect than component-level data (input → intermediate output). A pipeline that decomposes the task into sub-tasks each well-covered by existing data can outperform an end-to-end system even with an imperfect pipeline structure.

Key ideas

  • The best pipeline decomposition often corresponds to where labeled data is most available.
  • Publicly available datasets for "intermediate tasks" (car detection, pedestrian detection) make those components cheap and reliable.
  • End-to-end data (image → steering) is often expensive to collect, making end-to-end systems data-bottlenecked.
  • Data availability is a primary constraint in deciding pipeline architecture.

Key takeaway

Design pipeline components around tasks where you have abundant labeled data; those components will be easier to train and more reliable.


Chapter 51 — Choosing Pipeline Components: Task Simplicity

Central question

Besides data availability, what other factor determines good pipeline component design?

Main argument

Task simplicity as the second criterion. Beyond data availability, prefer pipeline decompositions where each component solves a simpler sub-task than the full end-to-end problem.

The complexity hierarchy. Ng provides a ladder of image classification tasks in increasing difficulty:

  1. Classifying whether an image is overexposed.
  2. Classifying whether an image was taken indoors or outdoors.
  3. Classifying whether an image contains a cat.
  4. Classifying whether an image contains a black-and-white cat.
  5. Classifying whether an image contains a Siamese cat (specific breed).

Each simpler task requires less data to learn and reaches higher accuracy with the same data budget.

The Siamese cat detector example. Rather than training one end-to-end Siamese cat classifier, a pipeline with (1) a general cat detector and (2) a breed classifier achieves better data efficiency: each component solves a simpler problem.

The autonomous driving corollary. Breaking driving into (detect cars, detect pedestrians, plan path) is better than end-to-end because each of the three tasks is simpler and individually learnable.

Key ideas

  • Task simplicity determines how much data a component needs; simpler tasks need less.
  • Well-decomposed pipelines have each component solving a task that is far simpler than the full task.
  • Human domain knowledge is valuable for identifying simpler sub-tasks.
  • The combination of data availability (Chapter 50) and task simplicity (Chapter 51) jointly determines good pipeline design.

Key takeaway

Design pipeline components to be individually simpler than the end-to-end task; each component will then train faster and more reliably with available data.


Chapter 52 — Directly Learning Rich Outputs

Central question

Can end-to-end deep learning extend beyond classification to structured or complex outputs?

Main argument

The classical output assumption. Traditional supervised learning maps inputs to simple outputs: integers (class labels) or real numbers (regression targets). Supervised learning was defined as h: X → Y where Y was a scalar or small vector.

Modern end-to-end outputs. Deep learning enables learning systems whose outputs are full sentences, images, or audio:

Task X Y
Image captioning Image Text description
Machine translation English text French text
Question answering (Text, Question) Answer text
Speech recognition Audio clip Transcript
Text-to-speech Text Audio

The enabling data condition. Each of these requires labeled pairs (X, Y) at scale. When large (X, Y) datasets exist for complex output types, end-to-end deep learning can learn them directly — without requiring the intermediate structure of a pipeline.

The trend. This expansion of what "Y" can be is one of the most significant developments in deep learning and will likely continue as training data for complex output types accumulates.

Key ideas

  • End-to-end deep learning works even when Y is a sequence, image, or audio clip, not just a number.
  • The constraint is data: you need large labeled (X, Y) pairs where Y is of the complex type.
  • Image captioning, machine translation, and TTS represent current successes.
  • This trend suggests that the divide between "AI components" will increasingly be replaced by learned end-to-end systems.

Key takeaway

End-to-end deep learning now handles complex structured outputs (sentences, images, audio) whenever sufficient labeled (input, output) pairs are available.


Chapter 53 — Error Analysis by Parts

Central question

How do you identify which component of a multi-step pipeline is causing the most errors?

Main argument

The Siamese cat pipeline error. Consider a two-stage Siamese cat classifier: (1) cat detector, (2) cat breed classifier. The system misclassifies an image. Who is at fault?

The informal inspection. Manually examine what each component produced for the misclassified example. If the cat detector produced a bounding box that misses the cat entirely, the cat breed classifier receives a cropped image of rocks — and correctly classifies it as "not Siamese." The error is clearly attributable to the cat detector.

The procedure for systematic analysis. For ~100 misclassified dev set examples, manually trace through the pipeline for each to determine which component(s) made a critical error. Tally: what fraction of errors are attributable to the cat detector vs. the breed classifier?

The actionable output. If 90 of 100 errors trace to the cat detector, invest in improving the cat detector. Those 90 misclassified examples now also constitute a labeled development set specifically for the cat detector — valuable for designing targeted improvements.

Key ideas

  • Error analysis by parts is error analysis applied component-by-component within a pipeline.
  • Most errors in multi-component systems can be traced to one dominant component.
  • The tracing procedure is informal but informative; a more formal procedure is covered in Chapter 54.
  • The misclassified examples attributed to a component become a dev set for improving that component.

Key takeaway

To identify where to invest in a pipeline system, manually trace ~100 misclassified examples through each component to count which component is responsible for the most errors.


Chapter 54 — Attributing Error to One Part

Central question

When error attribution is ambiguous, how do you unambiguously assign responsibility to one pipeline component?

Main argument

The ambiguity problem. If the cat detector produces a poor but not completely wrong bounding box, a skilled human could still recognize the Siamese cat from the resulting crop. In this case, is the error attributable to the detector or the classifier? It is unclear.

The formal test. Replace the component's output with a hand-labeled "perfect" output. Then run the rest of the pipeline with that perfect output:

  • Case 1: Even with a perfect bounding box, the breed classifier still misclassifies. → The breed classifier is at fault.
  • Case 2: With a perfect bounding box, the breed classifier now gets it right. → The cat detector is at fault.

The substitution principle. By providing "oracle" outputs for each component in turn, you determine which component's failure is necessary and sufficient to cause the overall system failure.

Key ideas

  • The formal test resolves ambiguity by providing oracle inputs to each component.
  • This approach gives unambiguous attribution even in borderline cases.
  • The method requires being able to manually construct a "perfect" intermediate output, which is usually feasible for concrete tasks.

Key takeaway

When error attribution is ambiguous, substitute hand-labeled "perfect" intermediate outputs and determine which component's failure is responsible for the overall failure.


Chapter 55 — General Case of Error Attribution

Central question

How does error attribution by parts generalize to pipelines with more than two components?

Main argument

The three-component algorithm. For a pipeline A → B → C:

  1. Replace A's output with a perfect output. If the system now works, attribute the error to A.
  2. Replace B's output with a perfect output (keeping the original A). If the system now works, attribute the error to B.
  3. Otherwise, attribute the error to C.

The autonomous driving application. For the pipeline (Detect cars A) → (Detect pedestrians B) → (Plan path C):

  1. Give the path planner perfect car detection. If the path plan improves, attribute to car detection.
  2. Give the path planner perfect pedestrian detection. If the path plan improves, attribute to pedestrian detection.
  3. Otherwise, attribute to the path planner.

The DAG constraint. The pipeline must be a Directed Acyclic Graph (DAG) — each component should depend only on earlier components' outputs. The error attribution procedure assumes this topological order.

Key ideas

  • The general three-step procedure applies to any A → B → C pipeline in DAG order.
  • Swapping the order of parallel components (A and B both feeding into C) gives similar but slightly different attribution results; both are valid.
  • The procedure requires the ability to manually construct a "perfect" output for each intermediate stage.
  • The attribution fractions guide investment priorities: fix the component responsible for the most errors.

Key takeaway

Generalize the two-component attribution test to any DAG pipeline by replacing each component's output in order and checking whether the system now performs correctly.


Chapter 56 — Error Analysis by Parts and Comparison to Human-Level Performance

Central question

How can you use human-level performance benchmarks within a pipeline to guide improvement priorities?

Main argument

The informal version of attribution. Rather than performing the formal substitution test, a faster approach is to informally compare each component's performance to human-level performance on that component's specific subtask:

  1. How far is the car detector from human-level car detection?
  2. How far is the pedestrian detector from human-level pedestrian detection?
  3. How far is the path planner from human-level path planning, given only the same inputs the planner receives (not the full camera image)?

Using the performance gap. The component with the largest gap from human-level performance is typically the highest-priority improvement target.

The limits of this approach. This method requires that humans can perform each component's task well, which is true for car detection and pedestrian detection but may not be true for path planning. If a component's task is one that even humans find difficult, the human comparison is unavailable.

Key ideas

  • Informal comparison to human-level performance is a fast substitute for the formal attribution test.
  • Each component has its own human-level benchmark.
  • The component furthest from human-level performance is usually the highest-priority improvement.
  • This method only applies to tasks where humans can be compared to the algorithm.

Key takeaway

As a fast diagnostic, compare each pipeline component to human performance on its specific subtask; the component with the largest gap from human level is the priority.


Chapter 57 — Spotting a Flawed ML Pipeline

Central question

What does it mean for the pipeline architecture itself to be flawed, and how do you detect it?

Main argument

The paradox of individually good components. Suppose each pipeline component is performing at (or near) human-level performance on its individual subtask. Does that guarantee the overall system performs at human level?

No — the pipeline architecture can be flawed. Consider the autonomous driving pipeline again. If (1) the car detector is at human-level car detection, (2) the pedestrian detector is at human-level pedestrian detection, and (3) the path planner is at human-level path planning given only the outputs of (1) and (2), but the overall system still falls far short of human-level driving, then the pipeline is flawed — it is missing critical information that a human driver would use.

The missing information diagnosis. A skilled human driver plans paths using not only knowledge of cars and pedestrians but also lane markings, traffic signals, road curvature, and other features. If those features are not passed to the path planner, no amount of improvement on the existing three components will close the gap.

The redesign. Add a lane marking detector as a fourth component, providing the path planner with the information it was missing. This is a structural fix, not a component-performance fix.

Key ideas

  • A pipeline can have all components at human-level performance but still fail overall if the pipeline architecture is missing key information pathways.
  • This diagnosis requires checking whether the overall system performance equals what would be expected given the performance of each component.
  • The solution is architectural redesign: adding components that provide missing information.
  • Identifying the missing information requires domain knowledge of what a human uses to perform the task.

Key takeaway

If all components are near human-level but the overall system still fails, the pipeline architecture is flawed — identify what information is missing and redesign the pipeline to include it.


Chapter 58 — Building a Superhero Team — Get Your Teammates to Read This

Central question

How should a well-informed ML engineer share the book's strategic knowledge with their team?

Main argument

Ng closes the book with a brief call to action: share the book with teammates. The strategic principles throughout the book are most valuable when everyone on a team understands them — reducing the friction of persuading teammates to adopt a particular direction.

The "superhero team" framing is deliberate: the book's goal is not to create one strategically expert person per team, but to raise the strategic fluency of the entire team so that diagnostic decisions can be made quickly, without prolonged internal debate.

Key takeaway

Share this book with your team; the principles have the most impact when everyone on the team understands and applies them.


The book's overall argument

  1. Chapter 1 (Why Machine Learning Strategy) — Strategic choices about what to prioritize determine ML project success more than any specific algorithm; most practitioners lack a systematic framework for making these choices.
  2. Chapter 2 (How to Use This Book to Help Your Team) — Short, shareable chapters enable a well-informed engineer to align their team on specific decisions without lengthy explanation.
  3. Chapter 3 (Prerequisites and Notation) — Basic supervised learning background is sufficient; the book is a strategic guide for practitioners, not a mathematical treatise.
  4. Chapter 4 (Scale Drives Machine Learning Progress) — Two forces — massive data and massive compute — explain the current deep learning wave; strategy must account for how performance scales with data and model size.
  5. Chapter 5 (Your Development and Test Sets) — Dev/test sets must reflect the target production distribution, not the distribution that was convenient for training; this is the foundation of all subsequent diagnostic work.
  6. Chapter 6 (Your Dev and Test Sets Should Come from the Same Distribution) — A shared distribution for dev and test ensures that optimizing for the dev set is optimizing for the right goal.
  7. Chapter 7 (How Large Do the Dev/Test Sets Need to Be?) — Size dev/test sets to detect the level of improvement you care about; the 70/30 rule is obsolete in the big-data era.
  8. Chapter 8 (Establish a Single-Number Evaluation Metric for Your Team to Optimize) — A single metric creates an unambiguous ranking over all models and experiments, enabling rapid iteration.
  9. Chapter 9 (Optimizing and Satisficing Metrics) — When multiple objectives compete, treat one as the thing to maximize and the others as threshold constraints rather than combining them arbitrarily.
  10. Chapter 10 (Having a Dev Set and Metric Speeds Up Iterations) — A dev set and metric transform qualitative hunches into quantitative evidence, enabling faster progress.
  11. Chapter 11 (When to Change Dev/Test Sets and Metrics) — Dev/test sets and metrics should change when they no longer point toward the right goal; this is a normal part of project development.
  12. Chapter 12 (Takeaways: Setting Up Development and Test Sets) — Summary of the setup principles in Chapters 5–11; treat these as a checklist for starting any new project.
  13. Chapter 13 (Build Your First System Quickly, Then Iterate) — A quick first system produces diagnostic clues unavailable from planning alone; start building immediately, then read the error signals.
  14. Chapter 14 (Error Analysis: Look at Dev Set Examples to Evaluate Ideas) — Manually examining 100 misclassified examples sets an upper bound on the value of any proposed improvement; two hours of analysis can save months of wasted work.
  15. Chapter 15 (Evaluating Multiple Ideas in Parallel During Error Analysis) — A parallel-column spreadsheet makes it possible to evaluate all plausible improvement directions simultaneously.
  16. Chapter 16 (Cleaning Up Mislabeled Dev and Test Set Examples) — Fix mislabeled examples when they represent a large fraction of remaining error; use a symmetric process to avoid bias.
  17. Chapter 17 (If You Have a Large Dev Set, Split It into Two Subsets, Only One of Which You Look At) — Splitting the dev set into Eyeball and Blackbox portions prevents overfitting to the examined examples.
  18. Chapter 18 (How Big Should the Eyeball and Blackbox Dev Sets Be?) — Size these sets by the number of errors you need to analyze, not arbitrary percentages.
  19. Chapter 19 (Takeaways: Basic Error Analysis) — Summary of the error analysis principles in Chapters 13–18.
  20. Chapter 20 (Bias and Variance: The Two Big Sources of Error) — Every ML error can be decomposed into bias (fails to fit training set) and variance (fails to generalize); they require opposite remedies.
  21. Chapter 21 (Examples of Bias and Variance) — Training error and dev error together reveal the diagnosis: high bias, high variance, or both.
  22. Chapter 22 (Comparing to the Optimal Error Rate) — The optimal (Bayes) error rate determines how much avoidable bias remains; human performance is the practical proxy for this rate.
  23. Chapter 23 (Addressing Bias and Variance) — Bigger model reduces bias; more data reduces variance; regularization decouples these two levers.
  24. Chapter 24 (Bias vs. Variance Tradeoff) — The classical tradeoff is less binding in deep learning because regularization and large data break the coupling between model size and variance.
  25. Chapter 25 (Techniques for Reducing Avoidable Bias) — Larger model, reduced regularization, new features from error analysis, and better architecture are the primary tools for bias reduction.
  26. Chapter 26 (Error Analysis on the Training Set) — Error analysis on training examples helps diagnose high-bias problems the same way it helps diagnose dev-set errors.
  27. Chapter 27 (Techniques for Reducing Variance) — More data is the most reliable variance reducer; regularization and early stopping are alternatives.
  28. Chapter 28 (Diagnosing Bias and Variance: Learning Curves) — A learning curve plots dev error vs. training set size; its shape reveals whether more data will help.
  29. Chapter 29 (Plotting Training Error) — Adding training error to the learning curve makes the bias/variance diagnosis visually unambiguous.
  30. Chapter 30 (Interpreting Learning Curves: High Bias) — When both curves plateau well above the desired level, more data cannot fix the problem — the model needs to be improved.
  31. Chapter 31 (Interpreting Learning Curves: Other Cases) — A large gap between training and dev curves indicates high variance; high curves with a large gap indicate both problems.
  32. Chapter 32 (Plotting Learning Curves) — Practical techniques for producing clean, reliable learning curves despite noise and class imbalance.
  33. Chapter 33 (Why We Compare to Human-Level Performance) — Human-level performance provides labeled data, error-analysis intuition, and a performance target — three benefits that disappear when machines surpass humans.
  34. Chapter 34 (How to Define Human-Level Performance) — Use the best achievable human performance as the benchmark; it gives the tightest bound on avoidable bias.
  35. Chapter 35 (Surpassing Human-Level Performance) — Even when the overall system surpasses humans, subsets where humans are still better can be diagnosed and improved using human-comparison tools.
  36. Chapter 36 (When You Should Train and Test on Different Distributions) — Use all available training data even if off-distribution; keep dev/test sets strictly on the target distribution.
  37. Chapter 37 (How to Decide Whether to Use All Your Data) — Include additional data unless no transferable knowledge exists between the additional data and the target distribution.
  38. Chapter 38 (How to Decide Whether to Include Inconsistent Data) — Exclude training data whose labels are inconsistent with the target distribution (same input, different correct output).
  39. Chapter 39 (Weighting Data) — Down-weight off-distribution training data proportionally when it vastly outnumbers target-distribution data.
  40. Chapter 40 (Generalizing from the Training Set to the Dev Set) — A training dev set (held out from the training distribution) allows precise decomposition of error into avoidable bias, variance, and data mismatch.
  41. Chapter 41 (Identifying Bias, Variance, and Data Mismatch Errors) — Four error numbers from four data sets pinpoint which failure modes are present and their magnitudes.
  42. Chapter 42 (Addressing Data Mismatch) — Understand what properties differ between training and dev distributions, then collect or synthesize training data that covers those properties.
  43. Chapter 43 (Artificial Data Synthesis) — Synthesis can bridge distributional gaps but risks overfitting to a narrow range of synthesized conditions; ensure adequate diversity of synthesis.
  44. Chapter 44 (The Optimization Verification Test) — When a system uses a learned scoring function plus approximate search, compare the scores of the correct vs. incorrect output to determine whether the search or the scorer is failing.
  45. Chapter 45 (General Form of Optimization Verification Test) — The score-then-search pattern appears throughout AI; the Optimization Verification test applies to all of them.
  46. Chapter 46 (Reinforcement Learning Example) — In RL, compare R(Thuman) and R(Talgorithm) to determine whether to fix the reward function or the RL algorithm.
  47. Chapter 47 (The Rise of End-to-End Learning) — End-to-end deep learning replaces hand-engineered pipelines with a single network; it works when abundant end-to-end labeled data is available.
  48. Chapter 48 (More End-to-End Learning Examples) — The pipeline vs. end-to-end choice depends primarily on which type of labeled data (intermediate or end-to-end) is more available.
  49. Chapter 49 (Pros and Cons of End-to-End Learning) — Pipelines encode domain knowledge and work with less data; end-to-end systems are unconstrained by hand-engineering and excel with large data.
  50. Chapter 50 (Choosing Pipeline Components: Data Availability) — Design pipeline components around tasks where abundant labeled data already exists.
  51. Chapter 51 (Choosing Pipeline Components: Task Simplicity) — Prefer pipeline decompositions where each component solves a simpler subtask, reducing data requirements per component.
  52. Chapter 52 (Directly Learning Rich Outputs) — End-to-end deep learning now handles structured outputs (sentences, images, audio) when large labeled (input, output) pairs are available.
  53. Chapter 53 (Error Analysis by Parts) — Trace misclassified examples through each pipeline component to count which component is responsible for the most errors.
  54. Chapter 54 (Attributing Error to One Part) — Formally attribute errors by substituting hand-labeled "perfect" outputs for each component and seeing which substitution fixes the overall system.
  55. Chapter 55 (General Case of Error Attribution) — Generalize the attribution procedure to any DAG pipeline with more than two components.
  56. Chapter 56 (Error Analysis by Parts and Comparison to Human-Level Performance) — Quickly identify the weakest pipeline component by comparing each one to human-level performance on its subtask.
  57. Chapter 57 (Spotting a Flawed ML Pipeline) — If all components are near human-level but the overall system still fails, the pipeline architecture is missing critical information; redesign it.
  58. Chapter 58 (Building a Superhero Team) — The book's principles have the most impact when shared across a team; distribute the book broadly.

Common misunderstandings

Misunderstanding: More data always helps.

More data reliably reduces variance, but has essentially no effect on avoidable bias. If training error is already far above the desired performance level, no amount of additional training data will close the gap — you need a bigger or better model. Chapter 20 establishes this distinction precisely; Chapter 30 shows how to see it visually in a learning curve.

Misunderstanding: The 70/30 train/test split is a reliable default.

The 70/30 split was appropriate in the data-scarce era when all data came from one source. In the modern era, training data and production data typically come from different sources, and 30% of a million examples is far more test data than needed. The split is now a potential trap, not a safe default.

Misunderstanding: Dev and test sets can come from different distributions as long as both are "reasonable."

Even "reasonable" distributions that differ between dev and test collapse the diagnostic power of the dev/test framework. If you overfit the dev set, you can no longer tell — the test result might be lower because of overfitting, a harder distribution, or a distribution shift. Identical distributions for dev and test are a prerequisite for interpretable evaluation.

Misunderstanding: A pipeline with individually excellent components will perform excellently as a whole.

Chapter 57 directly refutes this. A pipeline can have every component at human-level performance on its subtask but still fail at the system level if the pipeline architecture routes the wrong information. The components can only work with what they receive; if crucial information is never passed to the decision-making component, no component-level improvement will help.

Misunderstanding: End-to-end learning is always better because it avoids hand-engineering.

End-to-end learning avoids the ceiling imposed by hand-engineering, but it also discards the floor provided by human domain knowledge. With small or moderate data, a pipeline that encodes domain knowledge in intermediate stages will consistently outperform an end-to-end system. The choice depends on the relative availability of end-to-end labeled data versus labeled data for intermediate tasks.

Misunderstanding: Bias and variance always trade off.

In classical ML, increasing model capacity reduces bias but increases variance. In deep learning with large models and regularization, this tradeoff is substantially loosened: larger models combined with good regularization often reduce bias without increasing variance. Chapter 24 explains why the tradeoff is less binding in the modern era.

Misunderstanding: Human-level performance is a useful benchmark for all ML systems.

Human-level performance is useful when humans can perform the task well. For recommendation systems, ad-click prediction, or stock forecasting — tasks where humans themselves perform poorly — human-level benchmarks are unavailable or uninformative. The three benefits of human comparison (labeling, intuition, target setting) disappear in these settings.


Central paradox / key insight

The central insight of the book can be stated as follows: in machine learning, most of the effort that fails to produce results is wasted not because practitioners lack the right algorithm, but because they chose the wrong problem to fix.

Ng's observation, built from years of applied work at Google Brain, Baidu AI Group, and Coursera, is that the bottleneck in ML development is almost never "what algorithm should I use?" — it is "what is actually wrong with my current system, and of all possible improvements, which one has the highest expected impact per unit of time?"

The paradox is this: the tools needed to answer these questions — error analysis, learning curves, bias/variance decomposition, the Optimization Verification test, error attribution by parts — are not taught in ML courses, are not published in ML papers, and are rarely written down anywhere. They live as tacit knowledge in experienced practitioners. Yet they are arguably more consequential to real-world ML success than any specific architectural innovation. A team that can correctly diagnose its system's problems and prioritize the highest-leverage fix will consistently outpace a team with better algorithms but no diagnostic discipline.

"Most machine learning problems leave clues that tell you what's useful to try, and what's not useful to try. Learning to read those clues will save you months or years of development time." — Andrew Ng, Chapter 1


Important concepts

Avoidable bias

The difference between a model's training error and the optimal (Bayes) error rate. Only this portion of bias is worth targeting; the remainder is irreducible given the nature of the data.

Bayes error rate (optimal error rate)

The lowest possible error rate any classifier could achieve on a task, given the inherent noise and ambiguity in the data. Human-level error is the standard practical proxy for this rate on tasks where humans perform well.

Bias

Informally: the error rate of a learning algorithm on the training set. More precisely, the error rate on a very large training set that the algorithm would converge to. High bias indicates underfitting.

Variance

The additional error an algorithm incurs on the dev or test set compared to its training error. High variance indicates overfitting — the algorithm memorizes training examples rather than generalizing.

Dev set (development set / hold-out set)

A labeled dataset held out from training and used to make design decisions — tune hyperparameters, select features, compare model variants. Must come from the same distribution as the test set.

Test set

A labeled dataset held out from all decisions and used only for a final, unbiased estimate of system performance.

Training dev set

A dataset drawn from the training distribution but not trained on. Used to separate variance errors (training → training dev) from data mismatch errors (training dev → dev). Introduced in Chapter 40.

Eyeball dev set

The portion of the dev set that is manually examined during error analysis. Developers gain detailed understanding of this set, which means they may eventually overfit to it.

Blackbox dev set

The portion of the dev set that is only evaluated automatically, never manually examined. It provides unbiased automatic evaluation and is less prone to overfitting.

Optimizing metric

The single metric that a team maximizes without bound during model development (e.g., accuracy, F1 score).

Satisficing metric

A metric that must meet a threshold but is otherwise not maximized (e.g., "latency must be below 100ms"). Distinguishing satisficing from optimizing metrics enables cleaner single-objective optimization.

Error analysis

The process of manually examining misclassified dev set examples, categorizing them by error type, and using the resulting statistics to prioritize improvement directions. The foundational applied ML practice introduced in Chapter 14.

Data mismatch

A failure mode specific to settings where training and dev distributions differ. An algorithm can generalize well to new data from the training distribution but still fail on the dev distribution because the two distributions are different, not because of overfitting.

End-to-end learning

Training a single neural network to map raw inputs directly to final outputs, bypassing intermediate hand-engineered pipeline stages.

Learning curve

A plot of dev error (y-axis) versus training set size (x-axis). Used to diagnose whether more data will help and to identify the dominant failure mode (high bias vs. high variance).

Optimization Verification test

A diagnostic procedure for systems that combine a learned scoring function with approximate search. By comparing the score assigned to the correct output versus the system's output, it determines whether failures are caused by the search algorithm or the scoring function.

Error analysis by parts

The process of tracing misclassified dev examples through a multi-stage pipeline to identify which component is responsible for the most errors. The pipeline-level analog of basic error analysis.

Artificial data synthesis

Constructing new training examples by algorithmic combination of existing data (e.g., mixing speech with car noise). Used to bridge distributional gaps when collecting real target-distribution data is expensive or infeasible.

Human-level performance

The error rate achieved by the best available human performers on a task. Used as a proxy for the Bayes/optimal error rate, and as a target for estimating avoidable bias.


Primary book and edition information

Background and overview

Key ideas: bias and variance, learning curves

Key ideas: evaluation metrics

Key ideas: end-to-end learning, data synthesis

Book review

Additional chapter summaries and study resources

These are secondary summaries and should be used alongside, rather than instead of, the original book. The original PDF is freely available from deeplearning.ai.

Send feedback

Optional. We'll only use this if you want a reply.