Content Filtering › Visualization: Classifier Comparison and Threshold Effects
Language AI HandbookAll chapters Content Filtering › Visualization: Classifier Comparison and Threshold EffectsOne section · Sections in this chapter9 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable


The ROC and precision-recall curves tell complementary stories. The ROC curve shows that the n-gram classifier achieves a much higher true positive rate at any fixed false positive rate. The precision-recall curve illustrates the practical cost: at high recall, the keyword classifier's precision falls sharply, meaning many of its blocks are false positives. The n-gram model maintains substantially higher precision at the same recall level.

This plot makes threshold selection concrete. You can see exactly where the precision-recall tradeoff occurs for this classifier, and the F1 curve identifies the threshold that balances the two. In practice, you would not automatically choose the maximum-F1 threshold. Instead, you would choose the threshold that meets your operational requirements, such as "keep false positive rate below 2%" or "achieve at least 95% recall on severe harm categories."

This heatmap reveals a critical insight for filter evaluation: precision is not a fixed property of the classifier. It depends jointly on classifier quality (AUC), the selected operating point, and the prevalence of harmful content in your production traffic. Under the symmetric Gaussian operating-point assumption used here, even a strong classifier with AUC 0.95 achieves only about 7% precision when harmful requests make up just 1% of traffic. This means roughly 93% of blocked requests are false positives, not because the classifier is bad, but because the class imbalance is so extreme that even a small FPR generates many more false alarms than true alarms. This effect, known as the base rate fallacy, is why you should always evaluate filter performance on adversarially collected datasets with controlled class balance, not just on random production samples where precision numbers will look deceptively low.