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

[QUESTION] Forcing TFT model predictions to start at zero #2602

Open
benjamin-strath opened this issue Nov 21, 2024 · 3 comments
Open

[QUESTION] Forcing TFT model predictions to start at zero #2602

benjamin-strath opened this issue Nov 21, 2024 · 3 comments
Labels
question Further information is requested

Comments

@benjamin-strath
Copy link

Hi there,

I was wondering if anyone knew of a way to force predictions made using the TFT model to start at zero.
I ask because all of the time series I am using to train and test my model start at 0 but when making predictions the starting value is slightly off.

Any help would be greatly appreciated.

@benjamin-strath benjamin-strath added question Further information is requested triage Issue waiting for triaging labels Nov 21, 2024
@madtoinou
Copy link
Collaborator

Hi @benjamin-strath,

To my knowledge, there is no elegant way to force a zero value at the first timestamp of the predictions directly in the model. You could eventually have a post-processing pipeline to shift all the forecasts so that it always start at 0 but by doing so, you might increase the error at other timestamps.

Note that the first timestamp of each series is never part of the predicted values (because there is no values before to be used as features), so unless there is some periodicity in your data and you always make it so that the validation/test set start at the beginning of a cycle (at 0), I am not sure to understand what you mean by "all the time-series [...] start at 0".

@madtoinou madtoinou removed the triage Issue waiting for triaging label Nov 25, 2024
@benjamin-strath
Copy link
Author

Hi @madtoinou

Thank you for your response. Sorry, I should have explained myself better. My data is formatted so that for all timeseries the value at index input_chunk_length + 1 is zero (i.e. if input_chunk_length=16 the 17th value is zero). I believe this means my predictions should start at zero.

Could I ask what the non-elegant solution might be to forcing the model to start predictions at zero, without post processing?

@madtoinou
Copy link
Collaborator

Forcing is a big word, I would say that it's more about tricking/helping the mode to learn this pattern. You could try to create an future covariates, which could for example encode the distance to the beginning of the forecasts or maybe just mark the beginning of the forecasts (but 0 the rest of the time). Of course, this must be done for the series included in the training set as well.

However, I would say that such manipulation is not recommended and having a slight offset for this position should not be a big deal. I you really want this value to be 0, relying on reconciliation/post-processing to correct this kind of deviation should definitely be favored.

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

No branches or pull requests

2 participants