Speed up seasonal error calculation by shchur · Pull Request #85 · autogluon/fev

Issue #, if available:

Description of changes:

  • Speed up the calculation of seasonal error by using an efficient implementation based on np.bincount instead of Dataset.map
● Here are the benchmark results on the M5 dataset (30,490 time series):
  ┌──────────────────────────────────┬───────────┬────────────────┬─────────┐
  │             Function             │ OLD (map) │ NEW (bincount) │ Speedup │
  ├──────────────────────────────────┼───────────┼────────────────┼─────────┤
  │ _abs_seasonal_error_per_item     │ 20.039s   │ 2.527s         │ 7.9x    │
  ├──────────────────────────────────┼───────────┼────────────────┼─────────┤
  │ _squared_seasonal_error_per_item │ 20.101s   │ 2.486s         │ 8.1x    │
  └──────────────────────────────────┴───────────┴────────────────┴─────────┘
  Both implementations produce identical results (verified with np.allclose).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.