A JAX-based time-series forecasting library.
Project description
chronax
A high-performance, JAX-accelerated time-series forecasting library. chronax provides a comprehensive suite of classical and modern forecasting models — including AutoARIMA, AutoETS, AutoTheta, TBATS, MFLES, GARCH, and more — with a unified fit / predict interface and hardware-accelerated execution via JAX.
Features
- ⚡ JAX-accelerated — JIT-compiled model fitting and forecasting on CPU, GPU, or TPU
- 📈 20+ forecasting models including AutoARIMA, AutoETS, AutoTheta, TBATS, MFLES, GARCH, STL, and more
- 🔁 Unified API — every model follows the same
fit()→predict()pattern - 📊 Prediction intervals — built-in conformal and native interval support
- ✅ NumPy compatible — accepts and returns standard array types
- 🧪 Benchmarked against established libraries for correctness and speed
Installation
From PyPI (recommended)
Requires Python ≥ 3.11
pip install chronax
From TestPyPI (pre-release testing)
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ chronax
From GitHub source
Install directly from the latest commit:
pip install git+https://github.com/Smlcrm/Chronax.git
For local development:
git clone https://github.com/Smlcrm/Chronax.git
cd Chronax
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
pip install -e .
Usage Overview
Fitting a model and forecasting
All chronax models follow the same interface: instantiate, fit(), then predict().
import jax.numpy as jnp
from chronax.models import AutoARIMA
# Sample time series
y = jnp.array([112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118,
115, 126, 141, 135, 125, 149, 170, 170, 158, 133, 114, 140])
# Fit
model = AutoARIMA(season_length=12)
model = model.fit(y)
# Forecast 6 steps ahead
forecast = model.predict(h=6)
print("Forecast:", forecast['mean'])
Prediction intervals
Request probabilistic forecasts by passing level:
forecast = model.predict(h=6, level=[80, 95])
print("Point forecast:", forecast['mean'])
print("95% lower:", forecast['lo-95'])
print("95% upper:", forecast['hi-95'])
In-sample fitted values
Retrieve the model's in-sample predictions after fitting:
insample = model.predict_in_sample()
print("Fitted values:", insample['fitted'])
Memory-efficient forecasting
Use forecast() to fit and predict in a single call without storing model state:
from chronax.models import AutoETS
model = AutoETS(season_length=12)
result = model.forecast(y, h=6, level=[90])
print("Forecast:", result['mean'])
Comparing multiple models
from chronax.models import AutoARIMA, AutoETS, AutoTheta
models = {
"AutoARIMA": AutoARIMA(season_length=12),
"AutoETS": AutoETS(season_length=12),
"AutoTheta": AutoTheta(season_length=12),
}
for name, m in models.items():
m = m.fit(y)
pred = m.predict(h=6)
print(f"{name}: {pred['mean']}")
Available Models
Automatic Forecasting
Automatic model-selection wrappers that search over candidate configurations.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
AutoARIMA |
✓ | ✓ | ✓ | Native |
AutoETS |
✓ | ✓ | — | Native + conformal |
AutoTheta |
✓ | ✓ | — | Monte Carlo + conformal |
AutoMFLES |
✓ | ✓ | ✓ | Gaussian approx. + conformal |
AutoTBATS |
✓ | ✓ | — | Conformal |
AutoCES |
✓ | ✓ | — | Conformal |
ARIMA Family
Autoregressive integrated moving-average models for autocorrelated series.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
ARIMA |
✓ | ✓ | ✓ | Native |
Theta Family
Theta-method forecasters for trend and seasonality decomposition.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
Theta |
✓ | ✓ | — | Monte Carlo + conformal |
Multiple Seasonalities & Decomposition
Models designed for multiple seasonal patterns or explicit trend-seasonal decomposition.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
MFLES |
✓ | ✓ | ✓ | Conformal |
TBATS |
✓ | ✓ | — | Conformal |
MSTL |
✓ | ✓ | — | Conformal |
STL |
✓ | ✓ | — | Conformal |
Volatility Models
Models specialized for time-varying variance and heteroskedastic dynamics.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
GARCH |
✓ | ✓ | — | Native + conformal |
Baseline Models
Simple reference forecasters used as strong, interpretable baselines.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
HistoricAverage |
✓ | ✓ | — | Native + conformal |
Naive |
✓ | ✓ | — | Native + conformal |
SeasonalNaive |
✓ | ✓ | — | Native + conformal |
WindowAverage |
✓ | ✓ | — | Conformal |
SeasonalWindowAverage |
✓ | ✓ | — | Conformal |
RandomWalkWithDrift |
✓ | ✓ | — | Native + conformal |
Exponential Smoothing
Level, trend, and seasonal smoothing models with recursive state updates.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
ETS |
✓ | ✓ | — | Native + conformal |
Holt |
✓ | ✓ | — | Native + conformal |
HoltWinters |
✓ | ✓ | — | Native + conformal |
SimpleExponentialSmoothing |
✓ | ✓ | — | Conformal |
SeasonalExponentialSmoothing |
✓ | ✓ | — | Conformal |
Sparse / Intermittent Demand
Forecasters tailored to sparse series with many zeros or irregular demand arrivals.
| Model | Point Forecast | Probabilistic Forecast | Exogenous Regressors | Interval Type |
|---|---|---|---|---|
ADIDA |
✓ | ✓ | — | Conformal |
CrostonClassic |
✓ | ✓ | — | Conformal |
IMAPA |
✓ | ✓ | — | Conformal |
TSB |
✓ | ✓ | — | Native + conformal |
All models are importable from chronax.models.
Tutorial: Forecast a Time Series in Five Steps
1. Install the package
pip install chronax
2. Create a project
mkdir my-forecast && cd my-forecast
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install chronax
3. Write a forecast script (forecast.py)
import jax.numpy as jnp
from chronax.models import AutoETS
def main() -> None:
# Monthly airline passengers (subset)
y = jnp.array([112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118,
115, 126, 141, 135, 125, 149, 170, 170, 158, 133, 114, 140])
model = AutoETS(season_length=12)
model = model.fit(y)
forecast = model.predict(h=6, level=[80, 95])
print("Point forecast:", forecast['mean'].tolist())
print("80% interval:", list(zip(forecast['lo-80'].tolist(), forecast['hi-80'].tolist())))
print("95% interval:", list(zip(forecast['lo-95'].tolist(), forecast['hi-95'].tolist())))
if __name__ == "__main__":
main()
4. Run the script
python forecast.py
5. Explore further
Try swapping AutoETS for AutoARIMA or AutoTheta and compare results — the API is identical across all models.
Evaluation Benchmarks
We provide a benchmarking suite to evaluate chronax against other time-series libraries.
Note: Benchmark dependencies (such as
statsforecast,pandas, etc.) are not included in the core package to keep the installation lightweight.
# Install benchmark dependencies
pip install statsforecast pandas matplotlib
# Run the benchmark suite
python benchmarks/benchmark_suite.py
Documentation
| Component | Description |
|---|---|
chronax.models.* |
All forecasting model classes (see table above) |
chronax.utils.* |
Utilities — loss functions, plotting, conformal intervals |
Explore inline docstrings for detailed parameter and return-type information.
License
MIT © Simulacrum, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chronax-0.1.1.tar.gz.
File metadata
- Download URL: chronax-0.1.1.tar.gz
- Upload date:
- Size: 342.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6071e3633c021cac40563a06131728cadca62698865f04359c6a7a8990984d3e
|
|
| MD5 |
f930a286d8c550ab19d0a1583a14912f
|
|
| BLAKE2b-256 |
187680ff6356fea6f972d9b7ea0cef3bff395c4a529c70d063d3f23f2108cb8f
|
File details
Details for the file chronax-0.1.1-py3-none-any.whl.
File metadata
- Download URL: chronax-0.1.1-py3-none-any.whl
- Upload date:
- Size: 284.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eff596afa423582563223660cf7a59eba9fb8d073266af890211bdd07bf98512
|
|
| MD5 |
bdca3f0e111907e9c59e5ce0dc9bc66b
|
|
| BLAKE2b-256 |
5ca2b617275b98c2389ca1b0cf7da02117fcd47644ac1b25d611f50ad52c3627
|