Precision of a Spam Classifier
The support inbox is why Larkspur Mail cares about this one. Every time the filter quarantines a real email, somebody eventually notices and writes in, so the team needs to know how much the junk folder can be trusted as a verdict. The bake-off runs a fresh batch of hand-labelled test emails against every candidate build, so the figure is recomputed from that build's own counts.
Throughout, spam is the positive class - a "positive" is the filter raising the alarm, nothing more.
Task: Print the filter's precision for the spam class, as a single number rounded to 4 decimals. Round once, at the end.
Input
Four lines, each holding one whole number from a single evaluation run, in this order:
- spam, and the filter flagged it.
- real mail, and the filter flagged it anyway.
- real mail, and the filter let it through.
- spam, and the filter let it through.
Every run flags at least one email.
Output
One line holding the precision rounded to 4 decimals, printed the way Python prints a float - 0.8, never 0.8000.
Example:
Input:
40
10
45
5
Output:
0.8
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in