salesforce / CoST

PyTorch code for CoST: Contrastive Learning of Disentangled Seasonal-Trend Representations for Time Series Forecasting (ICLR 2022)
BSD 3-Clause "New" or "Revised" License
215 stars 43 forks source link

Rounding error concerning max_train_length #16

Closed RichardAffolter closed 1 year ago

RichardAffolter commented 1 year ago

Hi, I think there is a rounding error concerning the max_train_length

https://github.com/salesforce/CoST/blob/afc26aa0239470f522135f470861a1c375507e84/cost.py#L256-L259

To crop the data into cropped into some sequences, each of which has a length less than , the number of sections should be rounded up.

For example in the ETTh dataset cropping the train slice of length 8640 with max_train_length = 201 results in 42 sections of length 206, instead of 43 sections of length 201.

gorold commented 1 year ago

Thanks for the interest in our work! We actually inherit this piece of code from a prior work to keep the experimental setting equivalent for fair comparison. All the implemented representation learning methods also use this setting. Since this codebase is meant to reproduce the experimental results from our paper, we will leave it as such.