Skip to content

[ENH] Estimator checks let a constant-score or random anomaly detector pass #3771

Description

@mateenali66

The series anomaly detector checks in _yield_series_anomaly_detection_checks.py verify output shape and dtype but never compare scores to the labels that UNIVARIATE_SERIES_ANOMALY already provides. A detector that returns the same float at every timepoint passes every check today, and so does one that returns random noise. The metric layer already treats constant scores as a failure (roc_auc_score returns 0.0 with a warning), so the estimator checks are weaker than the benchmark metrics that sit beside them. I would like to add one check that fits on the labeled fixture and asserts that scores are not constant, that ranked scores place the labeled anomalies above the prevalence baseline, and for binary detectors that the positive rate is neither zero nor one. Detectors that cannot rank the synthetic fixture would opt out through an EXCLUDED_TESTS entry in aeon/testing/testing_config.py. This is the degenerate-detector guard from the FDES benchmark specification I maintain, which came out of a shipped detector that returned identical scores for 220 days until a user report, not a test, caught it (open-telemetry/opentelemetry-collector-contrib#46988, reported by pathcl). This is separate from #2801, which asks for a _fit_predict consistency check in the same yield function and has been waiting since #2326 merged. If this is welcome I will fold that check into the same PR so both land together. Happy to adjust the fixture or the baseline form to whatever the anomaly module maintainers prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions