The threshold — where a probability becomes a yes or a no
where did 0.5 come from?
What the CNN produces is a probability. To turn it into yes or no, somebody has to draw a line.
The map in lesson 1 had no intermediate colours. Of course it did not —
that map was already past the verdict.
What the CNN actually produces for a tile is one probability between 0 and 1.
"The chance there is a lymphocyte in this tile: 0.37", say.
To make a map you must turn that probability into yes or no, and for that you need
a threshold.
Happily, TCIA also released the maps from before the threshold.
Two of them ship with this course.
The red channel (R) carries the probability as 0–255, and the blue channel (B)
marks whether the tile is tissue.
The probabilities are spread out continuously. There is no obvious place to cut.
PythonRuns in your browser
Same slide, same CNN. The only difference is where the line was drawn.
PythonRuns in your browser
Drag the slider to move the threshold. The red area of the left-hand map grows with it.
Loading…
So where did 0.5 come from? Usually from nowhere at all.
The default for a binary classifier is 0.5, and it often just gets used.
Choosing it properly needs a reason —
match sensitivity and specificity on tiles a pathologist labelled
pick the point that best matches a clinical outcome (recurrence, say) — but watch out for the trap in lesson 15
do not cut at all — use the mean probability as it is
The Saltz paper chose its model on pathologist-reviewed tiles and put every slide
through human checking. Even so, the threshold remains a decision.
The moment you cut, information disappears. What you buy with it is a number that is easy to talk about.
PythonRuns in your browser
🤔 Check yourself
If you lower the threshold from 0.5 to 0.2, the infiltration rate…
Answer The lower the threshold, the more tiles pass. In the run above, going from 0.50 to 0.20 took it from 1.48% to 12.03% — an eightfold jump.
🤔 Check yourself
Which 'best way to choose a threshold' did this lesson warn against?
Answer Pick the threshold by looking at the outcome, then report that outcome's p-value, and you are reporting the minimum of many draws. Lesson 15 builds that trap by hand.