Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[<Library component: Model|Core|etc...>] How to forecast unknown periods with Nan? #1221

Open
skmanzg opened this issue Dec 2, 2024 · 2 comments

Comments

@skmanzg
Copy link

skmanzg commented Dec 2, 2024

What happened + What you expected to happen

goal: try to forecast data of the future period when there is no original data of the period.

I tried to use Y_test_df like the example of the document when its period are the next period of the original data.
Since there is no original data in its future data, it is full of NaN. (y is full of nan). Y_train_df is equal to the original data in this case.

and the error appears when I run this: forecasts = nf.predict(futr_df=Y_test_df)

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.

Time Series forecasting is to forecast unknown period but I do not know how to apply for practical usage like this? According to this error, it requires original data but I am not forecasting to observe how good forecast the model does. Please guide me to forecast in practical usage.

Versions / Dependencies

python 3.10

Reproduction script

model = iTransformer(
    h=186,
    input_size=372,  
    n_series=5,
    scaler_type='minmax',
    max_steps=500,
    early_stop_patience_steps=3,
    val_check_steps=50,
    # learning_rate=1e-3,
    loss=MSE(),
    valid_loss=MAE(),
    batch_size=32,
    
    factor=5,
    n_heads=5,
    e_layers=5,
    d_layers=5,
    
    accelerator='auto', 
    devices='auto',
    enable_model_summary=False,
    enable_progress_bar=True
)

nf = NeuralForecast(models=[model], freq='10min') 

nf.fit(df=Y_train_df, val_size=474)

forecasts = nf.predict(futr_df=Y_test_df)

Y_test_df is full of Nan in the next future period of the original data.

Issue Severity

High: It blocks me from completing my task.

@skmanzg skmanzg added the bug label Dec 2, 2024
@marcopeix
Copy link
Contributor

Hello! If I understand correctly, you don't need to pass a df when calling predict(). Simply fit the model like you did and call nf.predict(). This will make predictions starting from the end of Y_train_df for a horizon of 186.

If you pass a df to predict(), then you're asking the model to take this data as input and forecast the horizon following it. In your case, you don't have any values, so that causes the error.

Does that make sense? Let me know if that answers your question!

@skmanzg
Copy link
Author

skmanzg commented Dec 2, 2024

@marcopeix Thank you for reply. I will try what you said soon. I have one more question. Does NF support an imputation task too? Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants