laiguokun / LSTNet

MIT License
638 stars 171 forks source link

Bug in LSTNet.py #10

Closed fbadine closed 3 years ago

fbadine commented 5 years ago

I was looking at the LSTNet.py code and I found couple of issues: 1- There's a floating point issue that was mentioned in a previous issue that is now closed but the solution mentions that we need to cast the variable (presumably pt) to an int however this does not solve the issue unless pt has no floating point. If it has then int(-self.pt self.skip) will not be equal to int(-self.pt) self.skip Am I missing anything here?

2- The whole calculation of pt is a little weird to me cause from what I understood is that according to default values, the window is 24 7 while the skip is 24. 24 7 = 168 was transformed into 163 by the CNN layer hence we have changed space and we can no longer consider the skip as 24 but has to be the transformation of it through the CNN. Cause the information that was present in a 24 length is now in a shorter length in the transformed space. What is unchanged by this transformation is how many points there are when I skip 24. In the original space it was 24*7 / 24 = 7 points. Those 7 points still exist but are separated by a shorter than 24 "hours" duration. Isn't it correct? If so the whole calculation is different

Thanks! Fadi Badine

ICDI0906 commented 5 years ago

in the code, skipCNN is calculated after CNN, but skipCNN just means that increase the bash_size and decrease the length of the sequence , so what does the skip actually mean?

fbadine commented 5 years ago

When we are changing the dimensions this way, time values that are separated by "skip" value will be adjacent when entering the GRU network. Hence the SkipRNN (not skipCNN)

ICDI0906 commented 5 years ago

oh, you are right, it's skipRNN. if I occur the same problem, maybe I will use the index with the same step to achieve it. Thank you~

gusat commented 4 years ago

My 2 problems with skips in this context:

1) While quite effective --also cheaper than the full attention-- for 'well-behaved' univariates, our experience with some real-life time series shows that rarely a skip value is static (day, week etc.), as the periodic/seasonal components may vary across the temporal segments.

2) Multivariate skips: What about the case of N time series, each with its own skip (ie., N distinct skip parms), to be ingested simultaneously?

Finally, a bug of convention:

Q: Why does LSTNet plot the predicted target values with a -2h(orizons) offset in the past? That is, if eg., the forecasting horizon = 3 (time steps predicted ahead of the wall clock in data), shouldn't the predicted time series [RED] be plotted with h=3 steps BEFORE the in data [BLUE]? It's a matter of convention, as the time increases monotically from left/past to right/future, the forecasted plots in RED are expected to the LEFT of the actual in data in BLUE.

editorial "bash_size" => batch_size ;-)