ZeroTS is a zero-shot time-series forecasting codebase that reformulates forecasting as an image-reconstruction style pipeline. The implementation focuses on the pieces requested in the revision: leakage-free preprocessing, temporal gradient augmentation, adaptive patch selection and resampling, explicit hyperparameters, and reproducible evaluation scripts.
zerots.config.ZeroTSConfig: all core hyperparameters in one dataclass.zerots.forecast.ZeroTSForecaster: end-to-end forecasting pipeline.- Context-only normalization: statistics are computed from the observed history only, never from the future prediction window.
- TGA: original, first-order gradient, and second-order gradient channels.
- APSR: adaptive patch-size map and gradient-aware smoothing/resampling.
- Pluggable reconstruction backend:
InterpolationBackbonefor pipeline tests and sanity checks.HFMaskedAutoencoderBackbonefor HuggingFace ViTMAE-style checkpoints.CallableBackbonefor custom pretrained image-reconstruction models.
- CSV evaluation and synthetic demo scripts.
- Reproducibility documentation for method details and baseline protocols.
pip install -e .Optional dependencies:
pip install -e ".[hf,data,plot,dev]"python scripts/run_synthetic_demo.py --context-length 336 --prediction-length 96This runs the full preprocessing, masking, reconstruction, and inverse-mapping pipeline with the deterministic interpolation backend. It is intended as a sanity check. For paper-scale experiments, use a pretrained image-reconstruction backend.
python scripts/evaluate_csv.py \
--csv path/to/series.csv \
--value-column value \
--context-length 336 \
--prediction-length 96 \
--stride 96If your CSV has a timestamp column:
python scripts/evaluate_csv.py \
--csv path/to/series.csv \
--time-column date \
--value-column value \
--context-length 336 \
--prediction-length 96from zerots import ZeroTSConfig, ZeroTSForecaster
from zerots.backbones import HFMaskedAutoencoderBackbone
cfg = ZeroTSConfig(context_length=336, prediction_length=96, pod=24)
backbone = HFMaskedAutoencoderBackbone(model_name="facebook/vit-mae-base")
model = ZeroTSForecaster(cfg, backbone=backbone)
forecast = model.forecast(context)You can also pass any callable with the signature:
def reconstruct(image, mask):
return reconstructed_imageand wrap it with CallableBackbone.
- Normalization is fitted on the historical context only.
- The default multivariate mode forecasts each variable independently.
podcan be fixed from the dataset frequency or inferred from context-only autocorrelation. For revised experiments, prefer fixed dataset-frequency values and report them in the hyperparameter table.- If the sequence length is not divisible by
pod, the implementation pads only after the available context plus future placeholders. Padding cells are tracked and removed during inverse mapping. - The deterministic backend is not the method used for final accuracy claims. It exists to verify preprocessing and reconstruction mechanics without external checkpoints.
- Paper-scale accuracy experiments should use a pretrained image-reconstruction backend and should report the exact checkpoint, input resolution, patch size, mask construction, batch size, and device.
Detailed reproducibility notes are provided in:
docs/reproducibility.mdfor the ZeroTS pipeline.docs/baselines.mdfor baseline codebases, checkpoints, and protocols.
Report the following fields in the manuscript or appendix:
| Field | Code argument |
|---|---|
| Context length | context_length |
| Prediction length | prediction_length |
| Period/rows | pod |
| Image resolution | image_size |
| MAE patch size | patch_size |
| Minimum adaptive patch size | min_patch_size |
| Maximum adaptive patch size | max_patch_size |
| TGA/local variation window | tga_window |
| TGA mode | tga_mode |
| APSR overlap ratio | apsr_overlap |
| Interpolation | interpolation |
| Multivariate handling | multivariate_mode |
| Reconstruction checkpoint | backend-specific |
Unless otherwise specified in an experiment-specific config, the revised manuscript uses:
| Field | Value |
|---|---|
| Context length | 336 |
| Prediction lengths | 96, 192, 336, 720 for LTSF |
| Image resolution | 224 x 224 |
| MAE checkpoint | facebook/vit-mae-base |
| MAE patch size | 16 |
| TGA window | 3 |
| TGA mode | weighted_rgb |
| Minimum APSR patch size | 4 |
| Maximum APSR patch size | 16 |
| APSR overlap | 0.1 |
| Interpolation | bilinear |
| Future initialization | zero placeholder |
| Multivariate mode | independent per variable |