Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log error metrics (MALE and MSLE) #2621

Open
chris-mcdo opened this issue Feb 7, 2023 · 2 comments · May be fixed by #2634
Open

Add log error metrics (MALE and MSLE) #2621

chris-mcdo opened this issue Feb 7, 2023 · 2 comments · May be fixed by #2634
Labels
enhancement New feature or request

Comments

@chris-mcdo
Copy link

Description

@lostella suggested you might be interested in having the mean absolute log error (MALE) and mean square log error (MSLE) error metrics in GluonTS.

Here's a quick summary of the MALE and MSLE:

  • The metrics are both based on the “log error”, LE = log(f / y) (here f is the forecast, and y is the observed value).
  • Like other “relative” metrics (MAPE, sMAPE), they only really make sense for strictly positive data, and they assume the data have a meaningful zero point.
  • But in this case, they have some nice properties:
    • They produce estimates of the median and geometric mean respectively. By contrast, the MAPE and sMAPE produce biased estimates in general.
    • They can be interpreted as the average “relative” error (i.e., by what multiplicative factor you expect to be wrong).
    • They can be easily compared / aggregated across time series. (Like other relative metrics.)
    • They avoid the main problems of the MAPE and sMAPE.
  • They are basically the MAE and MSE on the log scale.

I wrote a longer (~10min) article making the case for these metrics here.

References

[1] https://towardsdatascience.com/mean-absolute-log-error-male-a-better-relative-performance-metric-a8fd17bc5f75
[2] Tofallis, Chris, A Better Measure of Relative Prediction Accuracy for Model Selection and Model Estimation (July 2014). Journal of the Operational Research Society (2015) 66, 1352–1362, Available at SSRN: https://ssrn.com/abstract=2635088

@chris-mcdo chris-mcdo added the enhancement New feature or request label Feb 7, 2023
@chris-mcdo
Copy link
Author

I'd be happy to write a PR for it.

Here are a few questions / thoughts I have about implementation:

  1. I notice that there are two model evaluation packages, gluonts.ev and gluonts.evaluation. Should I implement the metrics in both, or just one?
  2. The (expected) MSLE is minimized by the geometric mean of the true distribution. So it would make sense to compute the MSLE with respect to the geometric mean of the forecast distribution (see Inconsistent error definition #2272). But none of the Forecast classes have a method of getting the geometric mean. So for now, maybe we could use the median instead?

@jaheba
Copy link
Contributor

jaheba commented Feb 9, 2023

Hi Christopher,

I notice that there are two model evaluation packages, gluonts.ev and gluonts.evaluation. Should I implement the metrics in both, or just one?

evaluation is a convoluted mess and ev is an attempt to have a more consistent interface. However, ev is not used yet, but we plan to deprecate evaluation in favour of ev.

I think I would start implementing the metrics in ev and then we can think about if it makes sense to also have them in evaluation.

chris-mcdo added a commit to chris-mcdo/gluonts that referenced this issue Feb 9, 2023
chris-mcdo added a commit to chris-mcdo/gluonts that referenced this issue Feb 9, 2023
@chris-mcdo chris-mcdo linked a pull request Feb 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants