Skip to content
Tactiverge

Textbooks/Introduction to Intelligent Systems/Chapter 8Lite (plain text) version

8Evaluating intelligent systems honestly

Version 1 · Technically checked (automated checks only) · 4 source lessons · 8 practice items

Text
All chapters and search
  1. 1. Sense, think, act
  2. 2. Noise and filtering
  3. 3. Machine vision
  4. 4. Search and planning
  5. 5. Decisions under uncertainty
  6. 6. State estimation and sensor fusion
  7. 7. Learning from data
  8. 8. Evaluating intelligent systems honestly

Introduction

An intelligent system is only as good as the evidence that it works. This chapter treats evaluation as part of design: choose the metric before testing, keep test data untouched until the end, compare against a fair baseline, take the system apart with ablations to see which piece earns its place, and describe failure modes in words someone can act on. A result that survives all of that is worth reporting.

5-fold cross-validation, 400 examplesR1R2R3R4R5tinted: validation fold (80) · open: training (320)Report the mean and spread over all 5 rounds.
Figure 8.1. Five folds, five honest tests. Five-fold cross-validation of 400 examples drawn as a 5 by 5 grid. In each round one fold of 80 examples, shown tinted, is held out for validation while the model trains on the other 320. Every example is used for validation exactly once.

Explanation

This chapter is built from 4 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.

8.1 Designing a perception pipeline

Sense, filter, segment, measure, decide. Which stage of the pipeline fails first when the lights flicker?

Stages and interfaces

Write the pipeline as boxes: sense (camera or sensor, sample rate) → condition (filter, calibrate) → segment (threshold, colour rule) → measure (label, area, position) → decide (rule, threshold from costs). For each stage state its input, output, units and parameters. That list is your design, and also your debugging map.

One question at a time

A good investigation asks a focused question, changes one variable, holds the others fixed, repeats runs to see the spread, and chooses its metric (recall, precision, throughput) before looking at results. Record everything, including runs that look wrong.

Planning the term project

The project, 'Count the parts, honestly', needs: a set of images with hand-counted ground truth; separate tuning and test images; at least three conditions (normal, changed lighting, added noise or occlusion); a metric per condition; and one mitigation tried and measured. Plan the data before writing code.

Common mix-ups

  • If the final number looks right, every stage works.
    ✓ Errors can cancel. Check stage outputs too, especially under changed conditions.
  • Tuning on the test images is fine if you're careful.
    ✓ Any tuning on test data makes the test optimistic. Keep test images untouched until the end.

Open the full lesson: Designing a perception pipeline →

8.2 Evaluating honestly: held-out tests and failure modes

Your threshold scores 98% on the images you tuned it on. On new images it scores 81%. Which number goes in the report?

Tune on one set, test on another

Split data before you start: a tuning (or training) set for choosing parameters and a test set touched once, at the end. Any decision made by looking at test results, even choosing between two thresholds, leaks information and inflates the score. With little data, keep at least a small test set sacred.

Report by condition, with counts

Give precision and recall for each condition (normal, dim, noisy, occluded), with the underlying TP/FP/FN counts and the number of items. 'Recall 90% (27 of 30)' tells a reader how much to trust it; '90%' alone does not. Say how ground truth was obtained.

Failure modes are findings

A failure mode is a describable situation where the system goes wrong: touching parts merge, glare saturates pixels, shadows split objects. Show an example, explain the cause using this term's ideas, try one mitigation, and measure it on the test set. A report that hides its failures is less useful, and less trustworthy, than one that explains them.

Common mix-ups

  • Reporting the tuning-set score is fine if it's labelled.
    ✓ Label it, but the headline must be the held-out test score; the tuning score describes how well you fitted, not how well it works.
  • Failures make a project look bad.
    ✓ Well-explained, measured failures show you understand the system and help others avoid them.

Open the full lesson: Evaluating honestly: held-out tests and failure modes →

8.3 Benchmarking computer systems fairly

Your new code is '30% faster' on your laptop. Run it again and it's 5% slower. Which number goes in the report?

Protocol first

Fix the workload (inputs, sizes, a standard suite if one exists), the system (hardware, OS, compiler and flags, versions), conditions (power mode, temperature, background load) and the procedure: warm-up runs discarded, N timed repeats, randomised or interleaved order between the systems being compared. Write it down before running, as in Term 2's pre-registration.

Metrics

Primary metric: the one your claim rests on, chosen in advance (for example p99 latency). Secondary: throughput, energy per task, peak memory, accuracy. For distributions, report median and tail percentiles, not just the mean. Use execution time, not MIPS or GHz, as the Iron Law warns.

Uncertainty and comparison

Repeat runs vary. Report the spread (standard deviation or interquartile range) and a confidence interval for the difference between systems, from paired or interleaved runs. A 3% gain with a ±5% interval is not a demonstrated gain.

Trade-offs

Many systems win on one metric and lose on another: faster but hungrier, smaller but less accurate. A design is Pareto-optimal if nothing beats it on every metric at once. Show the front and say which point your requirement selects.

Common mix-ups

  • One run is enough if the computer is fast.
    ✓ Run-to-run variation is often several percent; repeats and intervals are essential.
  • The mean latency is the right summary.
    ✓ For deadlines and user experience, tails (p95, p99, max) matter more.

Open the full lesson: Benchmarking computer systems fairly →

8.4 Ablations: which part made it better?

Your new design is 40% faster. It has a bigger cache, a new predictor and a compiler flag. Which one did the work?

One change at a time

Start from the full system and remove (or start from the baseline and add) one component per run, holding everything else fixed: same inputs, same metric, same conditions. The difference from the reference attributes performance to that component.

Interactions

Components can interact: a bigger cache may make a prefetcher less useful, or a predictor may matter only with a deep pipeline. A full factorial design (every combination; 2ⁿ runs for n on/off components) reveals interactions; with many components, test the most plausible pairs.

Explain, don't just tabulate

Tie each effect to a mechanism. 'Two-way associativity removed the conflict misses because a[i] and b[i] share index bits' is a finding; '2-way is 4× better' is only a number. Mechanism-level explanations generalise to new workloads; raw numbers may not.

Common mix-ups

  • If the full system is better, every component must be helping.
    ✓ Some may do nothing or even hurt; only ablations show it.
  • Ablating each component once is enough.
    ✓ Components can interact; check plausible combinations and report uncertainty on each effect.

Open the full lesson: Ablations: which part made it better? →

Worked examples

Designing a perception pipeline: example 1

Write a one-line research question and method for the sorting machine.

Solution

'How does belt speed (0.3–1.0 m/s) affect sorting accuracy at fixed thresholds?' Method: same test batch, same thresholds, four speeds, three runs each, metric = % correctly sorted, recorded with parts per minute.

Evaluating honestly: held-out tests and failure modes: example 1

Test results: normal light TP 28, FN 2, FP 1; dim light TP 19, FN 11, FP 0. Summarise.

Solution

Normal: recall 28/30 ≈ 93%, precision 28/29 ≈ 97%. Dim: recall 19/30 ≈ 63%, precision 19/19 = 100%. Failure mode: in dim light faulty parts fall below the threshold (misses, not false alarms). Mitigation to test: brighter lighting or an adaptive threshold.

Benchmarking computer systems fairly: example 1

Ten paired runs of old vs new code give time differences (old − new) with mean 1.2 ms and standard deviation 2.0 ms. Is the new code faster?

Solution

SE = 2.0/√10 ≈ 0.63 ms. 95% CI ≈ 1.2 ± 1.3 ms = (−0.1, 2.5) ms. It includes 0: not demonstrated. Run more pairs or reduce noise.

Ablations: which part made it better?: example 1

Simulator misses for the colliding arrays: baseline (direct-mapped, 16 B) 16; 2-way only 4; 32 B blocks only 2; both 2. Main effects and interaction?

Solution

Associativity: ½[(4 − 16) + (2 − 2)] = −6. Block size: ½[(2 − 16) + (2 − 4)] = −8. Interaction: ½[(2 − 2) − (4 − 16)] = +6: once one fix removes the conflict, the other adds nothing. Mechanism: with 8 lines fixed, 32 B blocks double the cache to 256 B, so a[i] and b[i] no longer share an index. A cleaner ablation holds capacity fixed (halve the lines when doubling the block).

Interactive figures

Figure 8.2 from Evaluating honestly: held-out tests and failure modesOn the tuning batch, find the threshold with the highest accuracy and write down precision and recall. Switch to the fresh test batch without moving the slider. What changed? Is there a threshold that does well on both, and how would you have found it without peeking?
Can't use the interactive? Read a description instead

The confusion-matrix diagram has a tuning batch and a fresh test batch of 60 simulated parts each. A threshold chosen to maximise accuracy on the tuning batch usually gives a slightly different, often lower, accuracy, precision and recall on the test batch, because the two batches' random overlap differs.

Interactive figure (online). Description: The confusion-matrix diagram has a tuning batch and a fresh test batch of 60 simulated parts each. A threshold chosen to maximise accuracy on the tuning batch usually gives a slightly different, often lower, accuracy, precision and recall on the test batch, because the two batches' random overlap differs.

Figure 8.3 from Ablations: which part made it better?Baseline: 'Two arrays that collide', direct-mapped, 16 B blocks. Record the misses. Now change only associativity, then only block size (back to direct-mapped), then both. Fill a 2×2 table of misses. Then read the note under the simulator: what else changes when the block size changes with 8 lines fixed?
Can't use the interactive? Read a description instead

With 'Two arrays that collide' (16 reads): direct-mapped with 16 B blocks gives 16 misses; 2-way gives 4; direct-mapped with 32 B blocks gives 2, because the 8-line cache doubles in size; 2-way with 32 B blocks also gives 2.

Interactive figure (online). Description: With 'Two arrays that collide' (16 reads): direct-mapped with 16 B blocks gives 16 misses; 2-way gives 4; direct-mapped with 32 B blocks gives 2, because the 8-line cache doubles in size; 2-way with 32 B blocks also gives 2.

Laboratory

Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.

  • Nexus project

    Nexus: Automated sorting

    Run the sorting system with and without one sensor and report the change in errors as an ablation, with repeats.

    Open Nexus: Automated sorting →
  • Simulation OS experiment

    Simulation OS: Two-sensor fusion

    Compare the fused estimate against a camera-only baseline on the same seeds, and report the difference rather than two averages.

    Open Simulation OS: Two-sensor fusion →

Guided practice

Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.

Practice 1

Which change would make a belt-speed comparison unfair?

Practice 2

Why choose the metric before running the tests?

Practice 3

Your parts counter is wrong only in dim images. The threshold mask looks fine in bright images but patchy in dim ones. Which stage should you fix first?

Practice 4

You compare two thresholds on the test set and report the better one's score. What is wrong?

Practice 5

Which failure-mode statement is most useful?

Practice 6

Why discard warm-up runs?

Practice 7

Which is an ablation?

Practice 8

Doubling the L1 cache cut run time by 20%. Which follow-up best explains it from first principles?

  1. Which change would make a belt-speed comparison unfair?
    • Using the same test batch for every speed
    • Re-tuning the thresholds separately at each speed without saying so
    • Repeating each speed three times
  2. Why choose the metric before running the tests?
    • It saves time
    • So you can't pick, after the fact, whichever metric makes your favourite setting look best
    • Metrics change during testing
  3. Your parts counter is wrong only in dim images. The threshold mask looks fine in bright images but patchy in dim ones. Which stage should you fix first?
    • The decision rule
    • Segmentation (thresholding) or the lighting before it
    • Labelling
  4. You compare two thresholds on the test set and report the better one's score. What is wrong?
    • Nothing
    • Choosing on the test set makes it part of tuning, so the reported score is optimistic
    • You should have compared three
  5. Which failure-mode statement is most useful?
    • 'It sometimes doesn't work.'
    • 'In 6 of 10 dim images, parts below brightness 90 were missed; adaptive thresholding cut misses to 2 of 10.'
    • 'Dim images are hard for computers.'
  6. Why discard warm-up runs?
    • To hide slow results
    • Because first runs include one-off costs (cold caches, loading, JIT compilation) not present in steady state
    • To make the numbers smaller
    • Because the first run is always wrong
  7. Which is an ablation?
    • Comparing your system with a competitor's
    • Removing one component of your system at a time and measuring the change
    • Running the full system ten times
    • Tuning all parameters together
  8. Doubling the L1 cache cut run time by 20%. Which follow-up best explains it from first principles?
    • Report '20% faster' and stop
    • Measure the miss rate before and after and check whether AMAT × accesses per instruction accounts for the CPI change
    • Try a third cache size and pick the best
    • Measure clock frequency

Engineering applications

  • Self-driving test reports

    Serious evaluations of driving software report performance by condition (night, rain, junctions), not one overall score, because an average can hide the situation where the system fails.

  • Model cards

    Teams publishing a trained model increasingly document its intended use, the data it was tested on and where it performs poorly, so that others do not use it outside its evidence.

Watch

Optional verified videos. Nothing loads from YouTube until you press play.

Supervised learning explained with a simple classifier you can follow.

15 min 23 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Bias and variance, and why a model that fits the training data perfectly can fail.

6 min 36 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

  • Supervised Learning: Crash Course AI #2 (CrashCourse)
  • Machine Learning Fundamentals: Bias and Variance (StatQuest with Josh Starmer)

Chapter summary

  • Choose the metric and the decision rule before running the tests.
  • Test data stays untouched until the end; tuning on it turns a test into training.
  • Compare against a fair baseline on the same inputs, and report the difference with its uncertainty.
  • Ablations remove one component at a time to show which part caused the gain.
  • Failure modes should be specific: the condition, the effect and how often it happens.

Glossary

Baselines and control conditions
A baseline is the reference condition a new idea is compared with, such as the existing design or a simple method, tested in the same way.
Outliers and honest data
An outlier is a reading far from the rest. It may be a genuine effect or a fault; either way it must be investigated and reported, and any exclusion rule decided before seeing the results.
Stating limitations
A limitations section states plainly what your work cannot show: the conditions you did not test, the size of your sample, the assumptions in your models and the sources of uncertainty you could not remove.
Repeated trials
Repeating a measurement or test several times shows how much results vary and lets you average out random error.

Definitions from the Field Guide.

Project: An evaluation plan before the results

For a perception or fusion system from this book, write an evaluation plan: the metric, the baseline, the held-out data, one ablation and the decision rule. Then run it in simulation and report the result against the plan, including any deviation.

Deliverables

  • The dated evaluation plan
  • Results against the baseline with uncertainty
  • One ablation and a specific failure mode

Keep your work in your Engineering Journal; it stays private unless you choose to share it.

References

  • Trevor Hastie et al. (2009). The Elements of Statistical Learning, 2nd edition. Springer.
  • Stuart Russell and Peter Norvig (2020). Artificial Intelligence: A Modern Approach, 4th edition. Pearson.

Publication record

Version
1
Status
Technically checked (automated checks only)
Technical review
Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
Written by
Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
Licence
All rights reserved by the founders unless a licence is approved.
Corrections
None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.