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

Feat/statsforecasts #893

Merged
merged 19 commits into from
Apr 13, 2022
Merged

Feat/statsforecasts #893

merged 19 commits into from
Apr 13, 2022

Conversation

hrzn
Copy link
Contributor

@hrzn hrzn commented Apr 5, 2022

I've implemented a couple of models coming from Statsforecasts. The most interesting is probably their implementation of AutoARIMA, which uses Numba (and jit compilation) and can in some cases be much faster than pmdarima (after the first call to fit()). I would propose that we add it first as a separate model, and if everything goes well and it proves superior to the current AutoARIMA version, we could even replace it entirely at some point (it is not quite the same model, though).

@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2022

Codecov Report

Merging #893 (25df653) into master (2fd9d44) will decrease coverage by 0.01%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##           master     #893      +/-   ##
==========================================
- Coverage   91.57%   91.55%   -0.02%     
==========================================
  Files          71       73       +2     
  Lines        7165     7246      +81     
==========================================
+ Hits         6561     6634      +73     
- Misses        604      612       +8     
Impacted Files Coverage Δ
darts/models/forecasting/croston.py 85.41% <85.41%> (ø)
darts/models/forecasting/sf_auto_arima.py 91.17% <91.17%> (ø)
darts/models/__init__.py 80.95% <100.00%> (+4.20%) ⬆️
darts/models/forecasting/auto_arima.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fd9d44...25df653. Read the comment docs.


mu = forecast_df["mean"].values
if num_samples > 1:
std = 2 * (forecast_df["hi_68%"].values - mu)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a factor 2? Isn't hi_68 - mu equal to 1 std?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, same question

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I missed something, With a 68% forecast interval, it means that "hi - mu" represents 34% of the mass. (and "mu - low" represents the other 34%). So I multiply by 2 to get back one std (2x 34%). Makes sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK my bad that was right ;) Now fixed.

from darts.timeseries import TimeSeries


class Croston(ForecastingModel):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently TSB and croston_sba are improved version of Croston (https://www.lancaster.ac.uk/pg/waller/pdfs/Intermittent_Demand_Forecasting.pdf), might be worth proposing each of the 3 options in the same function as they already exist in statsforecast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done.

@hrzn hrzn merged commit 84801df into master Apr 13, 2022
@madtoinou madtoinou deleted the feat/statsforecasts branch July 5, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants