lss-1138 / SparseTSF

[ICML 2024 Oral] Official repository of the SparseTSF paper: "SparseTSF: Modeling Long-term Time Series Forecasting with 1k Parameters"
Apache License 2.0
82 stars 3 forks source link

odd period_len and kernel size #7

Open BiAnHua9 opened 1 week ago

BiAnHua9 commented 1 week ago

In Sparse/models/SparseTSF.py, the kernel size of nn.Conv1d() is set to 1 + 2 self.period_len // 2. As I try to use an odd period_len, It will raise error saying the shape of input x can not match itself after 1D convolution aggregation. I guess the kernel size should be set to 1 + self.period_len // 2 2 or 1 + 2 * (self.period_len // 2) ?

lss-1138 commented 1 week ago

Good job! Thank you for pointing this out. We missed this issue because we were only using even period_len values. We have now fixed this issue based on your suggestion (see the latest commit) so that the model works correctly with odd period_len values as well. Thanks again!