promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

Probability and baselines before models — step 7 of 7

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Flip the conditional the reliable way: by counting. Out of 10,000 transactions with a 2% fraud base rate, the detector alerts on 90% of fraud and 5% of legitimate traffic. Count the fraud cases, the legit cases, the alerts each group produces (use int() on each count), then compute P(fraud | alert) = fraud alerts / all alerts. Print the total alerts, the probability (:.1%), and whether most alerts are false alarms.

full-screen editor opens — close anytime to keep reading.