Twiga Forecast#

Twiga Forecast

Point & probabilistic time series forecasting -
one interface, every model.

Python 3.12 Apache 2.0
Install pip install twiga

Most forecasting libraries force a choice between ML and deep learning, between point forecasts and probabilistic ones, between training from scratch and leveraging pre-trained models, or between flexibility and production readiness. Twiga removes those trade-offs.

One interface, every model

A single TwigaForecaster trains, tunes, evaluates and backtests any model through an identical API. From parameter-free baselines and pre-trained zero-shot models to gradient-boosted trees, neural networks and weighted ensembles, switching architectures means changing one config object.

Explore models

Zero-shot forecasting, no training required

Chronos2, pre-trained on 2M+ diverse time series, generates 21-quantile probabilistic forecasts with no domain data, no fitting step and no calibration. Use it as a fast baseline, on small datasets, or blended in an ensemble with learned models.

Explore foundational models

Composable probabilistic architecture

Any backbone pairs with any distribution head without modification, giving a full matrix of probabilistic models from a small set of reusable building blocks. Adding a new architecture or head is a focused, isolated change.

Explore probabilistic

Calibrated uncertainty on any model

Conformal prediction wraps any trained model, including plain point-forecast models like LightGBM, with finite-sample intervals that carry a formal coverage guarantee. One call after training, no retraining and no distributional assumptions required.

Explore conformal prediction

Structured experiments and ablations

A single ExperimentEngine.run(spec) call runs backbone HPO once per dataset, then evaluates every condition across all folds with automatic MLflow tracking and result aggregation. Pydantic configs, Optuna integration, time-based backtesting and checkpoint-based resume are first-class throughout.

Explore experiment engine

Statistical analysis and feature intelligence

Eight feature-target association measures are computed in a single call and fused with Borda-count rank aggregation and random-forest importance to produce a robust ranked feature list. Stationarity tests, entropy measures and residual diagnostics are included, all returning tidy DataFrames. SHAP attribution is available for any fitted model via the optional twiga[explain] extra.

Explore feature analysis

Integrated visualization toolkit

A Lets-Plot suite covers the full workflow: forecast vs. actual plots, quantile fan charts, reliability diagrams, residual diagnostics and experiment result heatmaps. All functions return composable ggplot objects with no Matplotlib boilerplate.

Explore visualization

Production MLOps out of the box

An optional five-module stack covers experiment tracking, versioned checkpoints, drift monitoring, a production REST API and automated retraining as a schedulable workflow. All modules install together and operate without external infrastructure.

Explore MLOps