Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- time-series
|
| 5 |
+
- forecasting
|
| 6 |
+
- pytorch
|
| 7 |
+
- educational
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# TinyForecaster
|
| 11 |
+
|
| 12 |
+
A **~72,000-parameter educational time-series forecasting model**, built to understand — by actually building one — how zero-shot time-series foundation models work at a small scale.
|
| 13 |
+
|
| 14 |
+
**This is not a production model.** It is not competitive with real time-series foundation models like Chronos, TimesFM, or [t0-alpha](https://huggingface.co/theforecastingcompany/t0-alpha). It was trained on 6,000 synthetic series for 20 epochs on a single CPU core. Full writeup, including an honest zero-shot benchmark against classical forecasting methods and a real foundation model, is in the [GitHub repo](https://github.com/Vedantl39/tiny-timeseries-foundation-model).
|
| 15 |
+
|
| 16 |
+
## What it does
|
| 17 |
+
|
| 18 |
+
Given a 96-timestep context window, predicts the next 42 timesteps — trained **only on synthetic data** (randomized trend, seasonality, noise, scale), never on real data, then evaluated zero-shot on real retail sales data.
|
| 19 |
+
|
| 20 |
+
## Architecture
|
| 21 |
+
|
| 22 |
+
A small patch-based transformer:
|
| 23 |
+
- Input context (96 steps) normalized by its own mean/std, split into 12 patches of 8 steps each
|
| 24 |
+
- 2-layer transformer encoder, 32-dim embeddings, 4 attention heads
|
| 25 |
+
- Linear head projects to a 42-step forecast, de-normalized back to the original scale
|
| 26 |
+
|
| 27 |
+
## Honest result
|
| 28 |
+
|
| 29 |
+
Zero-shot MAPE on a real, held-out 42-day retail sales forecast: **24.87%** — worse than every classical method (SARIMA, Prophet, Holt-Winters) tested against the same data, and far behind t0-alpha's 6.53%. The specific failure mode (missing hard periodic zero-value drops, because the synthetic training data never included that pattern) is documented in the GitHub repo — it's a more useful finding than the raw accuracy number.
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import torch
|
| 35 |
+
from model import TinyForecaster # see github.com/Vedantl39/tiny-timeseries-foundation-model
|
| 36 |
+
|
| 37 |
+
model = TinyForecaster()
|
| 38 |
+
model.load_state_dict(torch.load("tiny_forecaster.pt"))
|
| 39 |
+
model.eval()
|
| 40 |
+
|
| 41 |
+
context = torch.tensor([...]) # shape (1, 96), your last 96 observed values
|
| 42 |
+
forecast = model(context) # shape (1, 42)
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Author
|
| 46 |
+
|
| 47 |
+
Vedant Limaye — built as a learning project after feedback from [Geoffrey Négiar](https://www.linkedin.com/in/geoffrey-negiar) (The Forecasting Company).
|