neuralforecast icon indicating copy to clipboard operation
neuralforecast copied to clipboard

Questions regarding AutoNBEATS/AutoNHITS

Open sdmishra123 opened this issue 1 year ago • 8 comments

I have some questions about AutoNBEATS and AutoNHITS, as mentioned below:

  1. The forecaster can use this code snippet <model.predict_insample()> to generate the model fitted in sample values, but it gives multiple forecasts for a single period. Do we need to average these forecasts, or is there another way to get the fitted values?
  2. How do I get the Trend and Seasonality components of the forecasts for the N-BEATS/N-HITS models?
  3. Can we build the NHITS model using exogenous variables like N-BEATSx?
  4. How do I decide on the search algorithms? The default is search_alg=BasicVariantGenerator(random_state=1)

sdmishra123 avatar May 08 '23 17:05 sdmishra123

Hey @sdmishra123,

Thanks for using the library. Answering your questions:

  1. The forecaster can use this code snippet <model.predict_insample()> to generate the model fitted in sample values, but it gives multiple forecasts for a single period. Do we need to average these forecasts, or is there another way to get the fitted values? The model.predict_insample() method will generate the in-sample predictions in a rolling window fashion. The reason behind the multiple forecast per period is that for each forecast creation date t, it will generate h time steps horizon forecast [t+1:t+h]. You can filter the necessary horizon depending on your task. For example, if you want the first forecasted step, you would filter t+1 for each forecast creation date t.

  2. How do I get the Trend and Seasonality components of the forecasts for the NBEATS/NHITS models? This notebook contains an example to extract the decomposition of an NHITS model: https://github.com/Nixtla/neuralforecast/blob/main/nbs/models.nhits.ipynb This notebook contains an example to extract the decomposition of an NBEATS model: https://github.com/Nixtla/neuralforecast/blob/main/nbs/models.nbeats.ipynb

  3. Can we build the NHITS model using exogenous variables like N-BEATSx? You can add exogenous variables to NHITS through the parameters of stat_exog_list and hist_exog_list. Here is the exogenous tutorial: https://nixtla.github.io/neuralforecast/examples/exogenous_variables.html

  4. How do I decide on the search algorithms? The default is search_alg=BasicVariantGenerator(random_state=1) Regarding search algorithms, we recommend you use hyperopt. Here is a tunning tutorial: https://nixtla.github.io/neuralforecast/examples/automatic_hyperparameter_tuning.html

kdgutier avatar May 08 '23 17:05 kdgutier

Thanks for your prompt reply! I will look at the links and get back to you if I have any further questions.

sdmishra123 avatar May 08 '23 17:05 sdmishra123

What does this error mean? RuntimeError: maximum size for tensor at dimension 2 is 392 but size is 448

My h=56 days and my input_size=392

sdmishra123 avatar May 08 '23 18:05 sdmishra123

Hey @sdmishra123,

This error arises when you are trying to use more information than that available in your series. You can solve it by reducing the number of lags that you are using through the input_size.

kdgutier avatar May 08 '23 18:05 kdgutier

I figured out the problem. I get this error when I pass the historical and future exons parameters in NBEATSx. Can you share the link of code to get the Trend and Seasonality components of the forecasts for the NBEATSx? The above link is for NBEATS

sdmishra123 avatar May 08 '23 19:05 sdmishra123

Hello,

Greatly appreciate your help so far! I was able to get the Level/Trend/Seasonal components for my model (NBEATS without exogs) using the link you shared, but I am unable to get the components for my model (NBEATSx with exogs). I keep getting the error - RuntimeError: maximum size for tensor at dimension 2 is 280 but the size is 336 when I run this line of code y_hat = nbeatsx.decompose(dataset=dataset)

sdmishra123 avatar May 09 '23 21:05 sdmishra123

Hey @sdmishra123,

Glad to hear that you are able to decompose predictions. Can you report this new problem into its own github issue?

kdgutier avatar May 10 '23 12:05 kdgutier

Can you share the link? Because it directed me here.

sdmishra123 avatar May 10 '23 13:05 sdmishra123