Commit 88a7ff0
committed
Correlating Anomalies via Temporal Overlap Similarity
OpenSearch anomalies such as service degradation, job delays, and incident bursts are represented as time intervals, not isolated points. If two detectors fire on the same incident, their anomaly intervals will substantially overlap in time (might with a little timestamp jitter due to different interval, detector start time, and causal relationship). Our similarity therefore measures:
* how much the time windows overlap (after a small tolerance δ to account for jitter),
* optionally, whether the duration is consistent.
This PR implements threshold-graph + connected components based on similarity.
Major algorithm:
- De-dupe input anomalies by id (stable insertion order).
- For every pair (i,j):
- Dilate both time intervals by ±delta to tolerate bucket alignment drift.
- Require dilated overlap >= minOverlap (cheap early filter).
- Compute temporal overlap:
- IoU (Jaccard over time) on dilated intervals
- Overlap coefficient (overlap / min(lenA,lenB)) for containment cases
- Detect strong containment (ovl >= tauContain and duration ratio <= rhoMax).
- Pick temporal term by mode:
- IOU: use IoU
- OVL: use overlap coefficient
- HYBRID: if strong containment, blend ((1-lam)*IoU + lam*OVL); else use IoU
- Compute duration penalty exp(-|durA-durB|/kappa).
- If strong containment, relax the penalty via pow(basePen, containmentRelax)
(or disable penalty entirely when containmentRelax == 0).
- Similarity = temporalTerm * penalty; add an undirected edge if similarity >= alpha.
- Run DFS connected-components on the threshold graph to form clusters.
- Output deterministically: sort members in each cluster by anomaly id.
- Attach an event window per cluster as [min(start), max(end)] across its members.
Testing done:
1. UT
2. Tests on real world data
Signed-off-by: Kaituo Li <kaituo@amazon.com>1 parent 7115d64 commit 88a7ff0
File tree
4 files changed
+1389
-0
lines changed- src
- main/java/org/opensearch/ad/correlation
- test/java/org/opensearch/ad/correlation
4 files changed
+1389
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments