How time encoded into a tensor by gluonTS

#11
by byjwangyu - opened

How does a time format like '2022-01-01' be encoded into a tensor of shape [b,s,2] by gluonTS

Hugging Face org
β€’
edited Mar 14, 2023

so the time index is encoded by first initializing the appropriate classes e.g. for hourly data we will use hour of day, day of week, day of month, day of year https://github.com/awslabs/gluonts/blob/dev/src/gluonts/time_feature/_base.py#L215

and then mapping the datetime index with these features and then stacking the resulting features so that it becomes a 4-dim vector for hourly data at each time point

the process is explained more here https://huggingface.co/blog/informer (see Step 4)

note the feature size (2) in your example above is determined by the freq resolution you need... for millisecond data this feature size will be larger and for quarterly data it will be smaller...

Thanks,kashif

Sign up or log in to comment