I am currently using NeuralForecast using historic...
# neural-forecast
y
I am currently using NeuralForecast using historical and future exogenous variables. The list of models works fine in the case of historical exogenous variables; however, it does not work when I pass future covariates. Am I missing something?
👀 1
c
Hi @Yalemzewd Nigussie. We have this tutorial on exogenous variables: https://nixtla.github.io/neuralforecast/examples/exogenous_variables.html.
Can you share the error please?
y
There is no error message. But, forecasts are NAN
c
Are you using the
predict
method? If so, you also need to pass the
futr_df
dataset with information for the future variables in the forecasting window (
h
values per unique_id). We are going to add a protection to prevent this from happening and give an informative error message.
y
image.png
c
futr_df
should not be a list, but a pandas dataframe with the values of the exogenous variables. Here is an example in the tutorial I sent you
y
Sorry, it was like this: Y_hat_df = nf1.predict(futr_df=df_future).reset_index()
I replicate the code in the tutorial
image.png
image.png
c
This weekly data right? can you set the frequency to 'W-SUN'?
y
OK, let me try and get back to you!
c
The most common issue with futr variables is some mismatch in the
futr_df
dataframe. Maybe: 1. A variable in the
futr_exog_list
is not in
futr_df
(wrong spelling for example). 2. Mismatch in future dates. The number of rows for each unique_id should match
h
exactly. In the current branch we have a protection for this case (not in pip yet)
For instance I see that for the unique_id in row 6 you have a date in
2023-04-30
. But in the
Y_df_futr
you are limiting to >
2023-07-15
so it might be missing the information
y
Good Catch. Thanks, let me check that again
c
I suggest you to start with a simpler case. Maybe only limit to your first unique_id and only one futr_variable, and test it. Then add more unique_ids, etc. It will be easier to detect the error.
We are also working on adding more asserts to catch potential issues and provide possible fixes 🙂
y
Thank Cris for your prompt response and help to identify the issue I had
🙂 1
Just tried for a single unique id