Machine Learning

Prevalence

Prevalence is the share of cases in a population that actually belong to the positive class, such as the fraction of circuit boards that are defective. It shapes how precision and accuracy figures should be read.

What is prevalence?

Prevalence is the share of cases in a population that actually belong to the positive class. If 20 of every 10,000 circuit boards are defective, the prevalence of defects is 0.002. From the confusion matrix, it is true positives plus false negatives divided by all cases. It describes the data, so it stays the same whichever model is tested.

Prevalence decides how other metrics behave. Recall, specificity, and the false positive rate are calculated within each actual class, so a change in prevalence alone does not move them. Precision, accuracy, and the F1 score mix the classes and move with it. When positives are the minority, the null error rate equals the prevalence.

Why prevalence matters

Test sets are often built at a prevalence the business will never see. A contract electronics manufacturer evaluated a solder-inspection model on 5,000 good and 5,000 defective boards. With recall of 0.95 and a false positive rate of 0.02, its precision on that balanced set was about 0.98. On the production line, where one board in 500 is defective, the same model would catch 190 of the 200 defects in 100,000 boards and flag about 2,000 good ones. Precision falls below 0.10, and the manual re-inspection station cannot keep up.

Ask for the test-set prevalence behind any quoted precision or accuracy figure, and recompute the figure at the real rate. Prevalence also shifts between sites and over time, so track it in model monitoring alongside data drift.

← Back to AI Glossary