|
Algorithm A1 Synthetic anomaly injection |
|
Require: Test values ; train+val values and alive mask ; alive mask M; period ; frequency ; severity ; correlation threshold ; max partners ; cooldown parameter C
|
|
Ensure: Perturbed series , window-level labels y
|
| 1: |
; False ▹occupancy mask |
| 2: |
for each feature f ▹ global per-feature scale, train+val only |
| 3: |
pairwise absolute correlation matrix of X over non-constant features |
| 4: |
features with strong lag- autocorrelation; for each , locate local peaks/troughs (donor candidates) |
| 5: |
; set target counts per type |
| 6: |
(collective length), (contextual length) |
| 7: |
function Partners(f) |
| 8: |
return up to features g with , ranked by correlation |
| 9: |
end function |
| 10: |
function TryCollective
|
| 11: |
Sample start s, feature f; let
|
| 12: |
if region free and f alive then
|
| 13: |
Cycle mode (round-robin, no repeats until all used) |
| 14: |
Perturb by magnitude per mode; repeat on each feature in Partners(f) using its own
|
| 15: |
; mark occupied; return success |
| 16: |
end if
|
| 17: |
end function |
| 18: |
function TryContextual
|
| 19: |
Draw next unused (feature , extremum c) pair; let
|
| 20: |
if region free and a same-feature donor extremum d of opposite phase exists with and correlation then
|
| 21: |
Replace with donor window ; repeat for each partner in Partners(f) using its matching-phase donor |
| 22: |
; mark occupied; return success |
| 23: |
end if
|
| 24: |
end function |
| 25: |
function TryPoint
|
| 26: |
Sample timestamp t, feature f
|
| 27: |
if and t free then
|
| 28: |
Cycle mode (round-robin); set ; repeat on each partner in Partners(f) |
| 29: |
; mark occupied; return success |
| 30: |
end if
|
| 31: |
end function |
| 32: |
Round-robin scheduling: while any active type is below its target count and below a failure-streak budget, cycle through {collective, contextual, point} in turn, attempting one placement per active type per pass; deactivate a type once its target count is reached or its failure streak is exceeded |
| 33: |
Assign each raw anomalous timestep as the positive label of its corresponding window; under this convention, window-level and point-level labels coincide one-to-one |
| 34: |
return
|