Nixtla / neuralforecast

Scalable and user friendly neural :brain: forecasting algorithms.
https://nixtlaverse.nixtla.io/neuralforecast
Apache License 2.0
3.07k stars 355 forks source link

Can model.forecast support batch of windows rather than just one? #210

Closed mistycheney closed 2 years ago

mistycheney commented 2 years ago

Is your feature request related to a problem? Please describe.

Is there a version of model.forecast that takes a batch of windows rather than just one window? Take NBEATS for example - maybe also applies to other models. Currently model.forecast only supports inputting one window and returning the forecast for that window. This is inefficient for testing on a long test time series with a large number of windows. The implementation right now does not allow using larger batches to fully utilize GPU.

Describe the solution you'd like

I would like the implementation of model.forecast be extended to support cases when the input contains multiple windows and the returned results are the forecast for each of the input windows.

kdgutier commented 2 years ago

Hi @mistycheney, thanks for the comment.

The NBEATS.forecast is intended to only predict self.n_time_out periods after last timestamp of Y_df. To follow forecasting conventions.

For your purpose we have the experiment utils functions:

Here experiment utils usage example.

mistycheney commented 2 years ago

Thanks. These are very helpful. I did not find these even though I have played around this library for a whole week, so ended up writing something similar to these myself. Would love it if these can be placed at a more eye-catching location of README and document page. Great library! Thanks.

kdgutier commented 2 years ago

Thanks for the suggestion, We have been thinking some time to include the prediction as a method for the classes. We are yet to think a general class to do it, and avoiding the code duplication across models.