Skip to content

Calibrated alerts: flags with a known error rate

A detector's own rule flags a fixed share of rows whether or not anything is wrong. Calibrate its scores against rows you take to be normal, and each flag comes with a false-alarm or false discovery rate you chose.

Applied ~10 min5 steps

You will be able to

  • Explain what a conformal p-value says about an anomaly score
  • Choose between controlling the false-alarm rate and the false discovery rate
  • Read the realized false-alarm rate on held-back reference rows

Read first

01

What does a score of 0.71 mean?

Read

A detector gives every row an anomaly scoreAnomaly scoreHow unusual a row is compared with the rest; a ranking for review, not proof of a problem., and its own rule flags the top share, 5% by default. On clean data it still flags 5%. The score ranks rows; it doesn't say how often a normal row would score that high.

Calibration answers that question. Pick reference rows that you take to be normal: a baseline period, rows someone has checked, or a random share of all rows when anomalies are rare. Their scores show what a normal score looks like.

02

The conformal p-value

Read

For any other row with score s:

p=1+#{reference scores≥s}nreference+1p = \frac{1 + \#\{\text{reference scores} \ge s\}}{n_\text{reference} + 1}

A row that scores above every reference row gets the smallest possible p-value, 1/(n + 1). A row in the middle of the reference scores gets about 0.5. If the row is normal and like the reference rows (exchangeableExchangeabilityUnder the null, any relabeling of the data is as likely as the one observed. Permutation tests rest on this.), its p-value is at most α with probability at most α. No assumption about the score's distribution is needed. This is a conformal predictionConformal predictionTurns any model's held-out errors into intervals or sets with a stated coverage. p-value.

So 5% can't be reached with 10 reference rows: the smallest p-value is 1/11, about 9%. The tab warns you when your target is below what the reference rows allow.

03

Two rates you can control

Read
ControlFlagsGuaranteeUse it when
False-alarm rate αrows with p ≤ αeach normal row is flagged at most α of the timeevery flag costs a check and you budget a fixed share of normal rows
False discovery rate qBenjamini–HochbergBenjamini–Hochberg procedureControls the false discovery rate by comparing sorted p-values with rising thresholds. on the p-valueson average at most q of the flagged rows are normalyou review the flags and want most of them to be real

The false-alarm rule is a fixed score cut-off: the tab shows it. The false discovery rule's cut-off moves with the rows being tested: many very unusual rows let it flag more.

Check yourself

A fraud team reviews every flagged transaction and wants at least 90% of what they review to be real fraud. Which control fits?

Show the answer

Answer: b

The false discovery rate bounds the share of normal rows among the flags, which is what the reviewers care about. A 10% false-alarm rate bounds how often a normal transaction is flagged, which can still leave most flags normal when fraud is rare.

04

Check it on rows the calibration never saw

Read

Hold back part of the reference rows. They're scored like every other row, and the share of them that gets flagged is the realized false-alarm rate, with a Wilson interval. An interval well above your target means the reference rows don't look like the normal rows you're testing: a different period, or rows picked because they looked clean.

A column of known anomalies adds three checks on tested rows: known normals flagged, known anomalies flagged, and the share of flags that are known anomalies.

Check yourself

You calibrate at a 5% false-alarm rate. The held-back reference rows show 14% flagged, interval [10%, 19%]. What's the most likely cause?

Show the answer

Answer: a

The guarantee only needs the reference rows to be exchangeable with the normal rows. A realized rate clearly above the target says they aren't, for example a calibration month that was quieter than the rest. The detector's strength affects how many anomalies are caught, not the false-alarm rate.

05

The run's scores or a refit

Read

By default the tab calibrates the run's own scores. Every row, the reference rows included, was part of the detector's fit, so the guarantee leans on the method treating all rows alike. Refit without the calibration rows re-runs the detector on part of the reference rows only and scores every other row out of sample: the exact split-conformal version, at the cost of a re-run and fewer rows tested.

Check yourself

You use a random 30% of all rows as reference rows, and about 2% of the data are anomalies. What do anomalies among the reference rows do?

Show the answer

Answer: a

High-scoring anomalies in the reference raise every tested row's p-value. Normal rows are flagged less often than the target, and so are anomalies, so the guarantee holds but the alerts lose some power.

The run's own flags, result card and Review queue don't change. Calibrated alerts are an extra view next to them.