Skip to content

Python analysis module: z-score severity thresholds are hardcoded #69

Description

@AnupamKumar-1

Called out in the README's "Anomaly detection: Node vs Python" table — the TS core supports a configurable z-score threshold, Python doesn't. In python/obyflow-python/obyflow/analysis/stats.py:

def classify_severity(z_score: float) -> DeviationSeverity:
    abs_z = abs(z_score)
    if abs_z < 1:
        return "none"
    if abs_z < 2:
        return "low"
    if abs_z < 3:
        return "medium"
    return "high"

The 1/2/3 cutoffs are fixed. Should let callers pass their own.

  • Add optional threshold params to classify_severity, e.g. low_threshold=1.0, medium_threshold=2.0, high_threshold=3.0
  • Thread them through as kwargs in detect_ml_anomalies (analysis/anomaly.py), the only caller
  • Add tests in test_analysis_stats.py / test_analysis_anomaly.py for non-default thresholds
  • Update the README table

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions