Skip to content

Add single-series anomaly detection#309

Merged
JE-Chen merged 1 commit into
devfrom
feat/anomaly-batch
Jun 21, 2026
Merged

Add single-series anomaly detection#309
JE-Chen merged 1 commit into
devfrom
feat/anomaly-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

data_drift is two-batch distribution shift and slo.burn_alerts only thresholds budget burn — neither points at which value in one live series is anomalous.

  • detect_anomalies(values, *, method="mad", threshold=None)[{index, value, score, is_anomaly}].
  • mad_anomalies / zscore_anomalies (flagged indices); mad_scores / zscore_scores (raw scores).
  • ewma_control(values, *, alpha, limit, target_mean, target_sigma) — EWMA control chart for sustained shifts.

MAD = robust Iglewicz-Hoaglin modified z-score. Pairs with timeseries.

Layers

  • Headless core: utils/anomaly/ (pure stdlib math/statistics, zero PySide6).
  • Facade: 6 symbols + __all__.
  • Executor: AC_detect_anomalies.
  • MCP: ac_detect_anomalies (read-only).
  • Script Builder: under Data.
  • Tests: test/unit_test/headless/test_anomaly_batch.py (9 tests).
  • Docs: v101_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_anomaly_batch.py → 9 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

data_drift is two-batch distribution shift and slo.burn_alerts only
thresholds budget burn — neither points at which value in one live series
is anomalous. Add detect_anomalies (mad/zscore scored records),
mad_anomalies / zscore_anomalies, mad_scores / zscore_scores, and an
ewma_control chart with an optional in-control baseline. Wired through
facade, executor (AC_detect_anomalies), MCP, and the Script Builder with a
headless test batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 46 complexity · 0 duplication

Metric Results
Complexity 46
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 9bb0e1a into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/anomaly-batch branch June 21, 2026 23:43
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant