https://github.com/andrewrgarcia/time2vec
Time2Vec neural network components. From paper: "Time2Vec: Learning a Vector Representation of Time" - https://arxiv.org/pdf/1907.05321.pdf
https://github.com/andrewrgarcia/time2vec
keras-tensorflow layers neural-networks representation-learning time-encoding time-series torch
Last synced: 9 months ago
JSON representation
Time2Vec neural network components. From paper: "Time2Vec: Learning a Vector Representation of Time" - https://arxiv.org/pdf/1907.05321.pdf
- Host: GitHub
- URL: https://github.com/andrewrgarcia/time2vec
- Owner: andrewrgarcia
- License: mit
- Created: 2023-10-07T16:55:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-25T19:25:09.000Z (over 1 year ago)
- Last Synced: 2024-11-25T20:26:54.288Z (over 1 year ago)
- Topics: keras-tensorflow, layers, neural-networks, representation-learning, time-encoding, time-series, torch
- Language: Python
- Homepage: https://colab.research.google.com/drive/1P2BOAaQlo54SqYCsL8FFq1PffDjQuO1F?usp=sharing
- Size: 77.1 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Time2Vec in Keras and Torch
My implementation of [Time2Vec: Learning a Vector representation of Time](https://arxiv.org/abs/1907.05321) as Keras and PyTorch Layers.
# How to Use It
**Head straight to our [Time2Vec Usage Template in Google Colab](https://colab.research.google.com/drive/1P2BOAaQlo54SqYCsL8FFq1PffDjQuO1F?usp=sharing)**
# The Concept
Time2Vec offers a versatile representation of time with three fundamental properties. It encapsulates scalar notion of time $\tau$, in $\mathbf{t2v}(\tau)$,
a vector of size k + 1. This transformation, for an $i^{th}$ element of $\mathbf{t2v}$, is defined as follows:
```math
\mathbf{t2v}(\tau)[i] =
\begin{cases}
\omega_i \tau + \phi_i, & \mathrm{if} & i = 0.\\
\mathcal{F}(\omega_i \tau + \phi_i), & \mathrm{if} & 1 \leq i \leq k.
\end{cases}
```
The above incorporates a periodic activation function denoted as $\mathcal{F}$, and involves learnable parameters $\omega_i$ and $\phi_i$ [[1]](https://arxiv.org/abs/1907.05321).
# Reference
1. 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](https://arxiv.org/abs/1907.05321)