Sub topic 13
Tuning Thresholds and Measuring Alert Quality
This chapter assumes you know how a scenario turns a typology into a rule, how thresholds and parameters control it, and how alerts are reviewed and given a disposition (closed or escalated). Here you will measure how well a scenario performs and use that to decide whether to change its thresholds.
Why tuning is needed
A scenario is only a starting guess. A threshold that looked sensible during design may flood analysts with alerts that are closed within minutes. Or it may miss activity that matters. Tuning is the process of changing parameters, using evidence from past alerts, so that the alerts reaching analysts are worth their time.
Two failure modes pull in opposite directions:
- Thresholds too low: many alerts, few of them useful. Analysts spend time on false positives, and real cases wait in the queue.
- Thresholds too high: few alerts, but genuine activity stays below the line and is never seen.
Measuring alert quality
The simplest measure is alert precision. It is the share of reviewed alerts that analysts escalated.
def alert_precision(dispositions):
"""Share of reviewed alerts that analysts escalated."""
if not dispositions:
return 0.0
escalated = sum(1 for d in dispositions if d == "escalated")
return escalated / len(dispositions)
print(alert_precision(["closed", "closed", "escalated", "closed"])) # 0.25Here one alert in four was escalated, so precision is 0.25. Low precision does not always mean a scenario is bad. Some scenarios cover high-risk typologies where a low hit rate is accepted. Compare precision for the same scenario across segments, across time, and against similar scenarios.
Other measures help build the picture:
| Measure | What it tells you |
|---|---|
| Alert volume | Workload the scenario creates per period |
| Alert precision | Share of reviewed alerts that were escalated |
| Average review time | Effort spent per alert |
| Share of alerts consolidated into existing cases | How much duplicate work grouping removes |
Precision only counts alerts that were reviewed. It says nothing about activity that never produced an alert, which is the harder problem.
Testing a change before using it
Do not change a production threshold on a hunch. A common method is below-the-line testing. You sample activity that sits just under the current threshold and review it as if it had alerted. If many of those samples would have been escalated, the threshold is too high. If almost none would, you have evidence that you can leave it alone.
The reverse test looks above the line. You re-run the scenario on historical data with a candidate parameter set and compare the results with the current set.
CURRENT = {"lookback_days": 7, "min_count": 3, "floor": 8000, "ceiling": 10000}
CANDIDATE = {"lookback_days": 7, "min_count": 4, "floor": 8000, "ceiling": 10000}
def compare(transactions, rule, current, candidate):
before = rule(transactions, current)
after = rule(transactions, candidate)
return {"current_alerts": len(before), "candidate_alerts": len(after)}You can pass structuring_alerts from the earlier chapter as rule. Raising min_count from 3 to 4 will lower the alert count. Next, check which alerts disappear. If any of them were previously escalated, the change has removed useful detection.
The tuning cycle
Common errors
- Tuning only to reduce volume. A lower alert count is not the goal. Detection of the risk the scenario covers is.
- Using too small a sample. Precision from ten alerts can swing widely. Collect enough reviewed alerts before acting.
- Changing several parameters at once. You then cannot tell which change caused the result.
- Skipping documentation. Record the old values, new values, evidence and approver so the change can be audited and validated later.
Exercise
A structuring scenario produced 200 reviewed alerts last quarter, and analysts escalated 6 of them. A colleague proposes raising min_count to cut the alert count. What is the precision, and what should you check before you approve the change?
Show answer
Precision is 6 / 200 = 0.03. Before approving, re-run the scenario on historical data with the new min_count and confirm that the 6 escalated alerts still fire. Also run below-the-line testing on activity that would stop alerting, to see whether any of it would have been escalated. Document the evidence and get approval.