Update README.md
Browse files
README.md
CHANGED
|
@@ -61,6 +61,21 @@ seq = torch.randn(1, 1024) # (batch, time)
|
|
| 61 |
pred_median, pred_quantiles = model(seq, forecast_horizon=forecast_horizon, quantiles=[0.1, 0.5, 0.9]) # (batch, time, quantiles)
|
| 62 |
```
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
We provide an extended quick start example in [notebooks/tutorial.ipynb](./notebooks/tutorial.ipynb).
|
| 65 |
If you dont have suitable hardware you can run the the extended quick start example example also in Google Colab:
|
| 66 |
|
|
@@ -74,7 +89,7 @@ If you dont have suitable hardware you can run the the extended quick start exam
|
|
| 74 |
- Architecture: Input residual MLP β stacked Transformer blocks (MHA + SwiGLU FFN, pre-norm, residual) β $|\mathcal{Q}|$ output heads mapping back to patch space.
|
| 75 |
- Positional encoding: Rotary Position Embeddings (RoPE) applied to queries/keys.
|
| 76 |
- Training: Multi-quantile (pinball) loss across positions, elements, and quantiles $\mathcal{Q}$.
|
| 77 |
-
- Inference: Predict next patch; roll out autoregressively
|
| 78 |
|
| 79 |
## Problem Formulation
|
| 80 |
Given context patches $x_{p_1}, \ldots, x_{p_n}$, predict the next patch $x_{p_{i+1}}$ for each position $i$ using only past patches (causality). The model outputs quantiles $\{\hat{x}_{p_{i+1}}^{(q)}: q \in \mathcal{Q}\}$ with median (q=0.5) as the point forecast.
|
|
@@ -105,7 +120,9 @@ Aggregate over positions, patch elements, and quantiles.
|
|
| 105 |
- Long-horizon: append prediction to context and repeat (optionally drop oldest patch to keep window fixed)
|
| 106 |
|
| 107 |
## Datasets
|
| 108 |
-
- UTSD (Unified Time Series Dataset) [UTSD]: seven domains (Energy, IoT, Nature, Web, Health, Transport, Environment). We
|
|
|
|
|
|
|
| 109 |
- Artificial: ~1M synthetic series (sinusoidal, linear, polynomial, logarithmic) plus mixtures via TSMixup [Chronos]; Gaussian Process samples via KernelSynth (mixtures of RBF/periodic/linear kernels with swept hyperparameters).
|
| 110 |
|
| 111 |
## Repository Layout
|
|
@@ -124,6 +141,7 @@ Aggregate over positions, patch elements, and quantiles.
|
|
| 124 |
- `dataset/` β data loading and preprocessing
|
| 125 |
- `artificial.py` β synthetic dataset : artificial signals + TSMixup + KernelSynth
|
| 126 |
- `utsd.py` β Unified Time Series Dataset (UTSD) loading and preprocessing
|
|
|
|
| 127 |
- `get_data.py` β utility to fetch and preprocess datasets
|
| 128 |
- `generate_data.py` β utility to generate and save the KernelSynth dataset (long to generate)
|
| 129 |
|
|
|
|
| 61 |
pred_median, pred_quantiles = model(seq, forecast_horizon=forecast_horizon, quantiles=[0.1, 0.5, 0.9]) # (batch, time, quantiles)
|
| 62 |
```
|
| 63 |
|
| 64 |
+
### from pip package
|
| 65 |
+
|
| 66 |
+
1. Install the package from PyPI
|
| 67 |
+
```bash
|
| 68 |
+
pip install patchfm
|
| 69 |
+
```
|
| 70 |
+
2. Run inference with a pretrained model from Huggingface Hub
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
import torch
|
| 74 |
+
from patchfm import PatchFMConfig, Forecaster
|
| 75 |
+
|
| 76 |
+
# same as above
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
We provide an extended quick start example in [notebooks/tutorial.ipynb](./notebooks/tutorial.ipynb).
|
| 80 |
If you dont have suitable hardware you can run the the extended quick start example example also in Google Colab:
|
| 81 |
|
|
|
|
| 89 |
- Architecture: Input residual MLP β stacked Transformer blocks (MHA + SwiGLU FFN, pre-norm, residual) β $|\mathcal{Q}|$ output heads mapping back to patch space.
|
| 90 |
- Positional encoding: Rotary Position Embeddings (RoPE) applied to queries/keys.
|
| 91 |
- Training: Multi-quantile (pinball) loss across positions, elements, and quantiles $\mathcal{Q}$.
|
| 92 |
+
- Inference: Predict next patch; roll out autoregressively for long horizons.
|
| 93 |
|
| 94 |
## Problem Formulation
|
| 95 |
Given context patches $x_{p_1}, \ldots, x_{p_n}$, predict the next patch $x_{p_{i+1}}$ for each position $i$ using only past patches (causality). The model outputs quantiles $\{\hat{x}_{p_{i+1}}^{(q)}: q \in \mathcal{Q}\}$ with median (q=0.5) as the point forecast.
|
|
|
|
| 120 |
- Long-horizon: append prediction to context and repeat (optionally drop oldest patch to keep window fixed)
|
| 121 |
|
| 122 |
## Datasets
|
| 123 |
+
- UTSD (Unified Time Series Dataset) [UTSD]: seven domains (Energy, IoT, Nature, Web, Health, Transport, Environment). We work with UTSD-12G (~18M series after preprocessing).
|
| 124 |
+
- GIFT-Eval pretraining dataset [GIFT]: aligned with the GIFT-Eval dataset but without data leakage issue with the benchmark. The dataset contains approximately 71 univariate and 17 multivariate time series datasets from various
|
| 125 |
+
domains and various frequencies. After preprocessing, this yields approximately 600K univariate series.
|
| 126 |
- Artificial: ~1M synthetic series (sinusoidal, linear, polynomial, logarithmic) plus mixtures via TSMixup [Chronos]; Gaussian Process samples via KernelSynth (mixtures of RBF/periodic/linear kernels with swept hyperparameters).
|
| 127 |
|
| 128 |
## Repository Layout
|
|
|
|
| 141 |
- `dataset/` β data loading and preprocessing
|
| 142 |
- `artificial.py` β synthetic dataset : artificial signals + TSMixup + KernelSynth
|
| 143 |
- `utsd.py` β Unified Time Series Dataset (UTSD) loading and preprocessing
|
| 144 |
+
- `gift.py` β GIFT-Eval pretraining dataset loading and preprocessing
|
| 145 |
- `get_data.py` β utility to fetch and preprocess datasets
|
| 146 |
- `generate_data.py` β utility to generate and save the KernelSynth dataset (long to generate)
|
| 147 |
|