An unusual measurement is a candidate for investigation; an incident requires a separate operational definition and evidence.
Anomaly detection contract: incidents, observations and delayed labels
Choose the decision unit
AI Trove might watch submitted receipts by tenant and hour. One low hourly count is an observation, while an incident may span several hours and related tenants. State whether the system ranks observations, opens tickets or identifies incident episodes. If retries duplicate receipts, counting them as fresh submissions creates a false baseline. The event contract fixes identity and partition before scoring.
Define exposure and context
A tenant with scheduled maintenance, a holiday closure or a new launch has a different expected volume from a mature tenant on an ordinary weekday. Preserve the calendar, active-tenant status and source health as context available when the alert fires. A missing feed cannot be interpreted as zero receipts until a separate ingestion check confirms that the source was live.
Keep labels separate
An analyst may confirm an incident days after the first alert. Store observed time, alert time, investigation time, label time and incident ID. A rejected alert is not automatically a normal observation if investigation never occurred. Delayed outcome monitoring should report the still-unreviewed population rather than quietly excluding it.
Test the record
Construct a 47-receipt hour, an unexpected 4-receipt hour, and a missing hour from a stalled feed. Only the second can be called a low-volume candidate without more evidence. Link two consecutive candidates to one incident ID and verify that episode-level metrics count one incident, not two independent true positives.
Implementation
def incident_candidates(hour_rows, expected_floor):
return [row for row in hour_rows
if row["source_healthy"] and row["count"] is not None
and row["count"] < expected_floor[row["tenant_id"]]]Performance and operating cost
Scanning N hourly records costs O(N) expected time with indexed tenant thresholds and O(A) output memory for A candidates. Episode grouping adds state by tenant and alert window; measure both point alerts and distinct investigations.
Common Mistakes
- Do not label a missing feed as a measured zero.
- Do not count several alerts from one incident as separate successful detections.
- Do not treat an unreviewed alert as a confirmed false positive.
Read next
- Contextual anomaly baselines: seasonality, exposure and missing periods
- Rare-event backtests: delayed labels, windows and incident recall
- Stream event contract: identity, version and partition key
- Model monitoring: separate input drift, data faults and delayed outcomes
Continue the workflow: Active-learning queues: uncertainty, coverage and selection bias.
