Nixtla / neuralforecast

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

ValueError: There are missing combinations of ids and times in `futr_df`. You can run the `make_future_dataframe()` method to get the expected combinations or the `get_missing_future(futr_df)` method to get the missing combinations. #1017

Open Mohan16071996 opened 1 month ago

Mohan16071996 commented 1 month ago

What happened + What you expected to happen

1.the bug: We are using Informer model with neural forecast. I get the mentioned error when I predict. forecasts = nf.predict(futr_df=test_data)

  1. expected behavior: Model to forecast properly
  2. logs: /usr/local/lib/python3.10/dist-packages/neuralforecast/core.py in predict(self, df, static_df, futr_df, sort_df, verbose, engine, **data_kwargs) 749 expected_cmd = "make_future_dataframe(df)" 750 missing_cmd = "get_missing_future(futr_df, df)" --> 751 raise ValueError( 752 "There are missing combinations of ids and times in futr_df.\n" 753 f"You can run the {expected_cmd} method to get the expected combinations or "

ValueError: There are missing combinations of ids and times in futr_df. You can run the make_future_dataframe() method to get the expected combinations or the get_missing_future(futr_df) method to get the missing combinations.

useful info: test_data size is 77*13, training data size is 26246 rows × 13 columns, which contains additional features added. I followed the sample informer given. input size is given as 77, the op is 7 days, for 11 tickers.

Versions / Dependencies

In Google Colab.

Reproduction script

Config:

model = Informer( h=7, # Predicting for 7 days input_size=77, # Use 14 days of history hidden_size=16, conv_hidden_size=32, n_head=2, loss=MAE(), futr_exog_list=calendar_cols, scaler_type='robust', learning_rate=1e-3, max_steps=1000, val_check_steps=50, early_stop_patience_steps=10 )

Pre processing: combined_data_panel, calendar_cols = augment_calendar_df(df=combined_data, freq='B')

Split data into train and test sets

train_data = combined_data_panel[combined_data_panel.ds < combined_data_panel['ds'].values[-7]] test_data = combined_data_panel[combined_data_panel.ds >= combined_data_panel['ds'].values[-7]].reset_index(drop=True)

train_data['ds'] = pd.to_datetime(train_data['ds']) test_data['ds'] = pd.to_datetime(test_data['ds'])

nf.fit(df=train_data, static_df=df_one_hot, val_size=12)

forecasts = nf.predict(futr_df=test_data)

Issue Severity

High: It blocks me from completing my task.

Mohan16071996 commented 1 month ago

can anyone please suggest on how to fix this issue?

Mohan16071996 commented 1 month ago

Also, my data set has only business days and also holidays and weekend data are not available. Maybe the missing combination is because of that?

jmoralez commented 1 month ago

Which of the suggestions from the error message did you try?