Perturbation, the seventh family: a jump back to normal is a Perturbation (nothing to do, greyed), Displacement keeps the lasting shift, the jump not back yet and the slow drift (labeling spec 2026-11-18-displacement-split-design); benchmark: 0 regression, Perturbation found 0 -> 4 %, +1 code line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 10:25:06 +01:00
1 parent 428ebaacfe
commit 47bc0acde2
4 files changed
+9 -8

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ AIMsight anomaly detectors (Python 3, standard library only) and their benchmark
## Rules
- A change to improve the detectors touches `scripts/*.py` and `thresholds.md` only; never `bench/`, which is the measure. Anything is possible there: add, remove or change a constant, a rule or a whole detector, as long as the six families remain.
- A change to improve the detectors touches `scripts/*.py` and `thresholds.md` only; never `bench/`, which is the measure. Anything is possible there: add, remove or change a constant, a rule or a whole detector, as long as the seven families remain.
- **Simple first**: a rule earns its place by its score on the benchmark, not by one case; prefer removing or widening a rule to adding a special case. The benchmark ends with the complexity of the detectors (code lines and constants of `scripts/`), `bench/compare.py` shows it before → after. A fix that adds a constant or more than 20 code lines earns them with at least 1 point on the `Total` of a family ("found" or "correct"); otherwise it fits one range: simplify it or drop it. A change that removes code without a regression is a gain in itself.
- **Pruning**: after a fix, each rule of the detector it touched (a condition, a branch, a constant a plainer value could replace) is tried without it, on a copy in the working folder (the copy's `bench/regression.py`, then `bench/compare.py`); a rule whose removal makes no regression is removed, one commit per rule, with its line of `thresholds.md`.
- **Everything is detected**: what is shown or not to a client is not the detectors' business. A setting chosen not to show something may be changed, saying so.
+2 -2
View File
@@ -4,7 +4,7 @@ The AIMsight anomaly detectors and their benchmark. Python 3, standard library o
## The detectors
Five modules in `scripts/`, one per kind of reading; each gives episodes of one or more of the six families:
Five modules in `scripts/`, one per kind of reading; each gives episodes of one or more of the seven families:
| Module | Reads | Families (varieties) |
|---|---|---|
@@ -12,7 +12,7 @@ Five modules in `scripts/`, one per kind of reading; each gives episodes of one
| `target_issue.py` | rejections day after day | Target issue (Degraded target), Obstruction (Target obscured) |
| `thermal_displacement.py` | the daily wave of the curves | Thermal displacement (Thermal expansion / contraction, Camera thermal expansion / contraction, Camera thermal movement) |
| `no_data.py` | the cadence of the measurements | No data |
| `displacement.py` | jumps and slow drift of the corrected curves | Displacement (Sudden jump, back to normal; Lasting shift; Jump, not back yet; Slow drift) |
| `displacement.py` | jumps and slow drift of the corrected curves | Displacement (Lasting shift; Jump, not back yet; Slow drift), Perturbation (Sudden jump, back to normal) |
`episodes.py` holds their shared helpers. `categories.py` runs them all and classifies their episodes into events (a jump back joins the visibility loss or the obstruction that explains it; the same variety less than an hour apart, one event), one line per event. The measurements are read by `scripts/data.py` of the tools repository, the sibling `~/aimsight-tools`.
+2 -1
View File
@@ -5,7 +5,7 @@ ignore, sensors (a Poor visibility also has its level). classify() makes them ev
- a target already in an overlapping Target issue episode is dropped from an Obstruction episode: its curve is already
to be ignored;
- a jump back to normal (JUMP_BACK) overlapping a Visibility episode joins its event: rain, fog or heat shimmer
explains it; otherwise it stays Displacement, its cause to be checked on the images;
explains it; otherwise it is a Perturbation: nothing to do;
- a jump back whose targets are all in an overlapping Obstruction or Target issue episode joins it (something in front
of them explains it, or the curve of a problem target is to be ignored); a slow drift, in a Target issue episode;
- episodes of the same variety less than MERGE apart make one event (validated rule, 2026-10-24); an Obstruction or a
@@ -38,6 +38,7 @@ CATEGORIES = {
"Thermal displacement": {"ignore": False, "process": "none"},
"No data": {"ignore": False, "process": "none"},
"Displacement": {"ignore": False, "process": "check"},
"Perturbation": {"ignore": True, "process": "none"},
}
JUMP_BACK = "Sudden jump, back to normal" # the label of displacement.py
MERGE = timedelta(hours=1)
+4 -4
View File
@@ -1,11 +1,11 @@
"""Displacement family: sudden jumps of the corrected displacements (corr_x, corr_y, px) of each target, and slow drift
"""Displacement and Perturbation families: sudden jumps of the corrected displacements (corr_x, corr_y, px) of each target, and slow drift
(end of file). Global references are excluded, rejected measurements (empty corr) skipped.
1. Jump: a measurement at least K noises (median step of the series) away from the level before (median of the BASE
previous measurements).
2. Back to normal: within BACK_H, an hour of measurements in a row (BASE at most, one at least) within half the jump of
the level before; greyed, its cause not established here (categories.py joins it to an overlapping Visibility or
Obstruction episode, otherwise it is to be checked on the images). Otherwise "Lasting shift", or "Jump, not back
the level before; a Perturbation, greyed (categories.py joins it to an overlapping Visibility or
Obstruction episode, otherwise nothing to do). Otherwise "Lasting shift", or "Jump, not back
yet" with less than BACK_H of hindsight: never greyed (maybe a real movement), the episode is the jump's instant;
the new level becomes the level before.
"""
@@ -53,7 +53,7 @@ def jumps(measurements):
if len(kept) > BASE:
t, v = [m["t"] for m in kept], [m[axis] for m in kept]
found |= {(t[a], t[b], state, name) for a, b, state in _jumps(t, v)}
return [episode(a, b, "Displacement", *LABELS[state], [name], state == "back") for a, b, state, name in sorted(found)]
return [episode(a, b, "Perturbation" if state == "back" else "Displacement", *LABELS[state], [name], state == "back") for a, b, state, name in sorted(found)]
def detect(measurements):