Repository navigation
[BUG] Use check_y output in continuous anomaly detection metrics - #3887
Conversation
check_y swaps the arguments when y_true is float and y_score is int, but the callers bound the result to (y_true, y_pred) and kept scoring the original y_score, so swapped calls scored the labels against themselves. Fixes aeon-toolkit#3880
Thank you for contributing to
|
|
Thanks for the review and merge! |
Reference Issues/PRs
Fixes #3880
What does this implement/fix? Explain your changes.
check_yswapsy_true/y_scorewhen their dtypes indicate they were passed the wrong way round (float labels, int scores), but the ten continuous metrics bound its result to(y_true, y_pred)and kept using the originaly_score, which on the swapped path is the label array. The metrics then scored the labels against themselves, e.g. ROC AUC of 1.0 for random or inverted scores.All ten call sites (
_continuous.pyand_vus_metrics.py) now rebindy_true, y_score. They_predname was not read before being reassigned in any of these functions, so there is no other behaviour change.Added
test_continuous_metric_swapped_arguments, parametrised overcontinuous_metrics: for a good and an inverted score, a swapped call warns ("permuted") and returns the same value as the correct-order call. The new test fails for all 9 metrics without the fix;test_ad_metrics.pypasses (55 tests) with it, andruff check/ruff format --checkare clean.Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.
PR checklist
For all contributions