#neural-forecast

Title

m

Manuel Chabier Escolá Pérez

07/16/2023, 4:58 PMHi all!
My question is related to how flexible is the outcome of N-BEATSx and N-HITS (e.g., if they can be trained with different outcome shapes).
I have a dataset which contains, for each timestamp, some relevant variables with their value at the moment, the forecasted value for some other predictors for the next “t” timestamps (2 timestamps in the example picture below) and the target variable for the next “t” timestamps. Something like I show in the picture below.
I need to keep this data structure because:
1) The forecasted values for X are updated every time (i.e., A and B are different than A’ and B’ because the latter will have been updated, and probably the forecasted values of X one timestamp in advance will be more reliable than the ones further away in time. Therefore, I do not want to use the last forecast available (in which case A and A' would be the same and I could change the structure of the dataset).
2) The second reason is that by maintaining this structure I can easily compare the model performance with several test sets I have already used with other models.
Therefore, my question is: are N-BEATSx and/or N-HITS compatible with making predictions with this shape? In the picture example, if the horizon to predict is 4, the model should predict 4 vectors of 2 elements each.
Thank you very much.

c

Cristian (Nixtla)

07/16/2023, 5:47 PMHi **@Manuel Chabier Escolá Pérez**! If I understand correctly, this is your setting:
1. You have two variables, namely

`X_1`

and `X_2`

.
2. At a timestamp `t`

you have previous values and forecasts for both variables.
3. The values of the variables update, so at `t`

the value of `t+2`

for variable `X_1`

is A. But then, at `t+1`

you update the previous value (still in the future, now one timestamp ahead), to A'.
Is this setting correct?In the library you can specify two types of temporal exogenous variables:

`historic`

and `future`

. For the former, the model to make a forecast at `t`

can only access historic values `<=t`

, and for the later it can use both historic and future values, up to `t+horizon`

. In this case both variables should be `future`

values, so models can access the forecasts.Now for the updating problem, there is currently no way to incorporate this behavior during training, as each variable can only have one value at each timestamp. You will need to define the variable, for example, to be the "forecasts of

`X_1`

done at timestamp t" (so taking values A in your diagram and so on).During inference (test), you can simply create you own for loop to make forecasts at every desired timestamp, and update the values of your variables manually before doing the forecast. So it would be a loop with first updating the data:

`Y_df`

and `futr_df`

, and then calling the `predict`

method.Hope this helps! It is a lot of information so let me know if something is not clear!

m

Manuel Chabier Escolá Pérez

07/16/2023, 6:34 PMHi Cristian! Thank you very much. What you suggest about the training part was my plan B (i.e., You will need to define the variable, for example, to be the "forecasts of

`X_1`

done at timestamp t"), but I wanted to make sure that there was not another approach. However, I had not thought about the loop for the testing set, and that is a very simple but great idea! I will try it. Thank you very much!