AI Cybersecurity Lab

Intrusion and anomaly detection, malware analysis, threat intelligence, phishing, security logs and incident response: defensive experiments that really compute in your browser on synthetic data, with algorithms, datasets, projects and quizzes.

28interactive experiments

Threshold and class imbalance

Cyber Anomaly Detection · Lesson Intermediate

The idea

An anomaly detector outputs a score; a decision needs a threshold. As real anomalies become rarer, precision falls quickly.

Explanation

Change the “true anomaly rate” in the experiment and watch PR-AUC drop while ROC-AUC stays relatively high. This is one of the most common evaluation mistakes.

Example

A detector with 1% FPR on a million events yields ten thousand alerts.

Review questions

  • Why does PR drop when anomalies are rare?

Related experiments

See also

References

  1. Saito, Rehmsmeier (2015). The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets. PLOS ONE 10(3), e0118432. doi:10.1371/journal.pone.0118432