MCPcopy Index your code
hub / github.com/Forgis-Labs/HEPA

github.com/Forgis-Labs/HEPA @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
107 symbols 456 edges 37 files 56 documented · 52%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

HEPA: A Self-Supervised Horizon-Conditioned Event Predictive Architecture for Time Series

Website arXiv Spotlight License: CC BY-NC-SA 4.0

Team: Jonas Petersen, Gian-Alessandro Lombardi, Riccardo Maggioni, Camilla Mazzoleni, Federico Martelli, Philipp Petersen

Critical events in multivariate time series, from turbine failures to cardiac arrhythmias, demand accurate prediction, yet labeled data is scarce because such events are rare and costly to annotate. We introduce HEPA (Horizon-conditioned Event Predictive Architecture), built on two key principles. First, a causal Transformer encoder is pretrained via a Joint-Embedding Predictive Architecture (JEPA): a horizon-conditioned predictor learns to forecast future representations rather than future values, forcing the encoder to capture predictable temporal dynamics from unlabeled data alone. Second, we freeze the encoder and finetune only the predictor toward the target event, producing a monotonic survival cumulative distribution function (CDF) over horizons. With fixed architecture and optimiser hyperparameters across all benchmarks, HEPA handles water contamination, cyberattack detection, volatility regimes, and eight further event types across 11 domains, exceeding leading time-series architectures including PatchTST, iTransformer, MAE, and Chronos-2 on at least 10 of 14 benchmarks, with an order of magnitude fewer tuned parameters and, on lifecycle datasets, an order of magnitude less labeled data.

Spotlight at FMSD @ ICML 2026.

Contributions

  1. One architecture, any event, any domain. A single 2.16M-parameter architecture with fixed hyperparameters, evaluated on 14 benchmarks across 11 domains. HEPA wins on 10 out of 14 while tuning 11x fewer parameters than PatchTST.
  2. Predictor finetuning as the downstream recipe. Freezing the encoder and finetuning only the predictor and event head (~198K params). On C-MAPSS, HEPA retains 92% of full-label h-AUROC at just 2% of labels.

Results

Quick Start

pip install -e .

# 1. Get the data (prints per-dataset sources and the expected layout)
export HEPA_DATA_DIR=/path/to/data
python scripts/download_data.py FD001

# 2. Pretrain + finetune + evaluate on C-MAPSS FD001
python scripts/train.py --dataset FD001 --seed 42

PyTorch >= 2.0 required. CPU works for unit tests; a single GPU is recommended for full training (a few minutes per dataset on an A10G).

Two settings are chosen per dataset (handled automatically): C-MAPSS uses a global z-score with no per-window RevIN and a fixed-epoch finetune; all other datasets use RevIN with early-stopped finetuning. Horizons are dense unit-step (K=150 for C-MAPSS/TEP, K=200 otherwise). See REPRODUCIBILITY.md for the full protocol and expected h-AUROC per dataset.

Note: this repository's C-MAPSS h-AUROC values are higher than those in the arXiv paper. There, the C-MAPSS finetune used validation-loss early stopping, whose stop point is sensitive on these datasets; here it runs for a fixed epoch budget, which is deterministic and reproducible. All other datasets are unchanged.

Supported Datasets

Dataset Domain Channels
FD001-004 Turbofan engine degradation 14
SMAP Spacecraft telemetry 25
PSM Server metrics 25
MBA Cardiac ECG arrhythmia 2
GECCO Drinking water quality 9
BATADAL Water-distribution attacks 43
TEP Chemical-plant faults 52
ETTm1 Electricity transformer load 7
Weather Climate forecasting 21
BeijingAQ Air quality / public health 11
VIX Financial volatility 6

Citation

@article{petersen2026hepa,
  title   = {HEPA: A Self-Supervised Horizon-Conditioned Event Predictive
             Architecture for Time Series},
  author  = {Petersen, Jonas and Lombardi, Gian-Alessandro and Maggioni,
             Riccardo and Mazzoleni, Camilla and Martelli, Federico and
             Petersen, Philipp},
  journal = {arXiv preprint arXiv:2605.11130},
  year    = {2026}
}

License

Copyright (c) 2026, Forgis. Licensed under CC BY-NC-SA 4.0.

Core symbols most depended-on inside this repo

get_horizons
called by 8
hepa/utils/config.py
chronological_split
called by 5
hepa/data/_common.py
finetune_forward
called by 4
hepa/model/hepa.py
build_label_surface
called by 4
hepa/evaluation/surface.py
maybe_sync_target
called by 3
hepa/model/hepa.py
pretrain_forward
called by 3
hepa/model/hepa.py
_engines_to_entities
called by 3
hepa/data/cmapss.py
zscore
called by 3
hepa/data/_common.py

Shape

Function 69
Method 28
Class 10

Languages

Python100%

Modules by API surface

hepa/model/encoder.py14 symbols
hepa/training/finetune.py10 symbols
tests/test_model.py8 symbols
tests/test_metrics.py7 symbols
hepa/training/pretrain.py7 symbols
hepa/model/hepa.py7 symbols
hepa/evaluation/metrics.py6 symbols
hepa/data/cmapss.py5 symbols
hepa/utils/config.py3 symbols
hepa/training/losses.py3 symbols
hepa/model/target_encoder.py3 symbols
hepa/model/predictor.py3 symbols

For agents

$ claude mcp add HEPA \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page