Add xPatch dual-stream forecasting model
Author: smellslikemlCreated Sep 21, 2026Updated Sep 21, 2026
Proposal
Add XPatchModel, a dual-stream time-series forecasting model, as a new TorchForecastingModel.
xPatch decomposes the input with an exponential moving-average (EMA / DEMA) seasonal-trend split, then processes the seasonal component with a patch-based CNN stream and the trend component with a linear MLP stream. It fills a gap next to the existing decomposition/linear models (DLinear, NLinear, TSMixer): a patch-CNN seasonal path that none of them provide.
- Paper: xPatch: Dual-Stream Time Series Forecasting with Exponential Seasonal-Trend Decomposition — Stitsyuk & Choi, AAAI 2025 (arXiv:2412.17323).
- Reference implementation: stitsyuk/xPatch, Apache-2.0.
Fit with Darts
- Implemented as a
PastCovariatesTorchModel: supports past covariates (as channel-independent input features) and probabilistic forecasting via Darts' likelihood models. - Module follows the current contract (#3204):
forward()takesPLModuleInput→ returnsPLModuleOutput;_create_model()readsTorchTrainingSampleby named field — mirroringDLinearModel/NLinearModel. - nn.Module internals adapted from the Apache-2.0 reference, made device-agnostic and wired to Darts' RevIN.
Scope
darts/models/forecasting/xpatch_model.py+ registration in the two__init__.pyfiles.- Tests via the public
fit/predictAPI (darts/tests/models/forecasting/test_xpatch.py). - Docs: model tables (
README.md,docs/source/index.rst,docs/userguide/torch_forecasting_models.md) +CHANGELOG.md.
I have a branch ready (rebased on current master) and can open the PR if there's interest. Contribution is AI-assisted (drafted with Claude Code, human-reviewed); disclosed in the PR body and commit.
Source: unit8co/darts