aeon icon indicating copy to clipboard operation
aeon copied to clipboard

[BUG] performance_metrics/forecasting/_functions.py unrunnable code

Open TonyBagnall opened this issue 4 months ago • 0 comments

Describe the bug

more legacy nonsense. The functions geometric_mean_absolute_error and geometric_mean_squared_error contain untested code

            np.abs(errors),
            sample_weight=horizon_weight,
            axis=0,
        )

but the actual signature of _weighted_geometric_mean is def _weighted_geometric_mean(y, weights=None, axis=None): (see #2134)

i.e. the parameter name is wrong! doctests all skipped for some reason.

Steps/Code to reproduce the bug

import numpy as np
from aeon.performance_metrics.forecasting import \
    geometric_mean_squared_error as gmse
y_true = np.array([3, -0.5, 2, 7, 2])
y_pred = np.array([2.5, 0.0, 2, 8, 1.25])
gmse(y_true, y_pred, horizon_weight=[0.5,0.3,0.2, .1,.1])

Expected results

runs

Actual results

C:\Code\aeon\venv\Scripts\python.exe C:\Code\aeon\aeon\local\debug.py 
Traceback (most recent call last):
  File "C:\Code\aeon\aeon\local\debug.py", line 6, in <module>
    gmse(y_true, y_pred, horizon_weight=[0.5,0.3,0.2, .1,.1])
  File "C:\Code\aeon\aeon\performance_metrics\forecasting\_functions.py", line 1427, in geometric_mean_squared_error
    output_errors = _weighted_geometric_mean(
TypeError: _weighted_geometric_mean() got an unexpected keyword argument 'sample_weight'

Versions

No response

TonyBagnall avatar Oct 02 '24 12:10 TonyBagnall