thuml/Time-Series-Library

Quick question regarding the embed arg

Closed this issue · 2 comments

Thanks you very much again for your work! It is really helpful for my master thesis. I have a question regarding the embed argument with the options timef, fixed and learned. I am not sure if my understanding is correct. If I use timef as an argument, it will be used to determine d_inp, which is used to determine the input dimension for the linear transformation in the embedding layer. However, no explicit embedding of time features is done such as day of the week. For this I would need to use embedding type fixed. Is this correct? Can I also add custom embeddings such as e.g. a specific holiday/Christmas period? If so how should I approach this? I would highly appreciate your help!

Thank you very much!!

Actually it's not the case. If you select 'timeF' as the arg embed, then each piece of date information will be transformed into a d_inp-dim time_feature vector. d_inp is determined by the arg 'freq', whose options can be 'h'(hour), 'm'(minute) etc.(for more you can see in 'run.py'). Thus you can choose the frequency that fits your data so that date info will be correctly encoded into time features. If you wanna know exactly how the encoding works, you can see it in detail in [utils/timefeatures.py][https://github.com/thuml/Time-Series-Library/blob/main/utils/timefeatures.py). Briefly, each element of this d_inp-dim vector is confined in scope [-0.5, 0.5] and denotes the relative position in some cycle (eg. week, month, year).

If you need to encode some specific holiday info, it seems that there's no ready-made method to do it. But you can try to add this by adding a dim in time_feature vector. Try to modify timefeatures.py to implement your rule of encoding.

If you have further questions, feel free to contact.

Thank you very much for your response. This helps.