An intuitive, custom TensorFlow.Keras Layer for Time2Vec Transformation.
Keras implementation of Non-local blocks from [1].
Time2Vec offers a versatile representation of time with three fundamental properties. It encapsulates scalar notion of time
The above incorporates a periodic activation function denoted as
The script time2vec.py
contains the Time2Vec
instance which takes a single or a group of time series and concatenates the above
from time2vec import Time2Vec
k = 20
time_series = np.linspace(0, 100, 1000).reshape(-1,1)
time_series = Time2Vec(num_frequency=k)(time_series)
print(time_series)
...
For a more interactive experience check out this Google Colab
- Seyed Mehran Kazemi, Rishab Goel, Sepehr Eghbali, Janahan Ramanan, Jaspreet Sahota, Sanjay Thakur, Stella Wu, Cathal Smyth, Pascal Poupart, Marcus Brubaker. "Time2Vec: Learning a Vector Representation of Time." arXiv:1907.05321 [cs.LG], 11 Jul 2019. Link