Skip to content

[ENH] Refactor range-based metric API for consistency with other AD metrics #2780

Closed
@SebastianSchmidl

Description

@SebastianSchmidl

Describe the feature or idea you want to propose

I would like to make the method signature of the new methods equal to the old proxy methods in _binary.py because of these reasons:

  • streamlined API: all existing metrics use y_true as the first parameter and y_pred as the second
  • consistency with the previous implementation in aeon
  • consistency with the implementation in TimeEval

At the same time, there are some further optimizations possible:

  • removal of the anomaly range input possibility (all our datasets and algorithms use either a vector of anomaly scores or binary predictions; no component supports lists of anomaly ranges)
  • restoration of the old default values
  • adding the new range metrics to the standard metric test suite in tests/test_ad_metrics.py
  • marking the range_metrics.py-file as private by renaming it to e. g. _range_metrics.py

Describe your proposed solution

I. a. switching from

def ts_recall(y_pred, y_real, gamma="one", bias_type="flat", alpha=0.0):
  ...

to

def range_recall(
    y_true: np.ndarray,
    y_pred: np.ndarray,
    alpha: float = 0,
    cardinality: str = "reciprocal",
    bias: str = "flat",
) -> float:
   ...

Metadata

Metadata

Labels

anomaly detectionAnomaly detection packagebenchmarkingBenchmarking packageenhancementNew feature, improvement request or other non-bug code enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions