Choosing a good threshold
A sorting machine calls a part 'large' if it's over 65 mm. A part measures 64.9 mm. Is it large?
About 25 min · 3 goals · Checked by automated tests; not yet reviewed by an educator
1.Why should I care?
A sensor gives a number; a machine needs a decision. The threshold is the bridge. Smoke alarms, spam filters, medical tests and sorting machines all work by picking a threshold, and picking it well is a real engineering decision with real consequences.
- ◇ Explain what a threshold is and how it splits readings into groups.
- ◇ Sort items using a given threshold, including at the edge.
- ◇ Describe the trade-off when a threshold is moved up or down.
2.Predict
A smoke alarm sounds when its smoke reading goes above a threshold. If engineers lower the threshold, what happens?
Guess first. Being wrong here is how the surprise works.
3.Discover
Use the client's brief and thresholds to sort six parts by hand. Look closely at any part whose reading is near a threshold: which side of the line is it on?
Can't use the interactive? Read a description instead
The sorting-machine activity can be replaced by this description: a colour sensor says how red each part is, a light gate measures its length and a metal detector senses metal. The client's brief sends metal parts to the Metal bin, large non-metal parts to Reject, small red plastic to Red, and everything else to Mixed. One part measures 58 mm, which is below the 65 mm size limit, so it is not large.
4.Understand
A threshold draws a line
A threshold is a value that splits readings into two groups: above and below. 'Large' means size > 65 mm. 'Dark' means light level < 30. The rule only cares which side of the line a reading is on, not how far.
Two kinds of mistake
Real readings are a bit noisy. Put the threshold too low and you get false alarms (reacting when you shouldn't). Too high and you get misses (not reacting when you should). Moving the line always trades one for the other.
Picking the value
Engineers choose a threshold by looking at real readings from both groups and putting the line in the gap between them. If there's no clear gap, they think about which mistake is worse. For a smoke alarm, a miss is far worse than a false alarm.
Explain it another way
A height bar at a theme park ride is a threshold. Everyone taller than the line can ride; everyone shorter can't. Where the park puts that line is a safety decision.
Thresholding turns a continuous measurement into a category. With noisy sensors the groups overlap, so any threshold produces some false positives and some false negatives; the threshold sets the balance between them.
A greenhouse controller might open the vents above 28 °C. Set it at 24 °C and the vents flap open on every sunny spell, wasting heat; set it at 35 °C and the seedlings cook before anything happens.
Worked example 1
A part sorter calls a part 'large' if its length > 65 mm. Parts measure 58, 65, 66 and 80 mm. Which are large?
58 > 65? No. 65 > 65? No (equal is not greater). 66 > 65? Yes. 80 > 65? Yes. 66 mm and 80 mm are large.
Common mix-ups
- A perfect threshold never makes mistakes.
✓ With real, noisy readings, every threshold makes some mistakes. You choose which kind you'd rather have. - A reading on the threshold counts as above it.
✓ That depends on whether the rule says > or ≥. Always check the edge.
5.Practice
Practice, not a test. Wrong answers get a hint and another try.
Practice 1 · a fresh version every time
Rule: IF temperature > 40 °C THEN switch the fan on. The sensor reads 41 °C, 55 °C, 40 °C, 33 °C, 43 °C, 47 °C. For how many of these readings does the THEN branch run?
Practice 2
A doorbell camera alerts you when motion is above a threshold. Leaves blowing keep triggering it. What should you do?
Practice 3
For a smoke alarm, which mistake is worse?
Practice 4
Small parts measure between 40 and 55 mm. Large parts measure between 75 and 90 mm. A good threshold sits halfway across the gap between the groups. What value is that, in mm?
6.Apply it
Design a 'too loud' warning light for a classroom. Choose a threshold for a sound sensor (say, 0–100). Describe one situation that would cause a false alarm and one that would cause a miss. Which would you rather risk?
7.Reflect
Concepts: Thresholding and simple classification