chronos-ts
chronos-ts is a pure-Rust, parallelized time-series analysis and forecasting
library with optional Python bindings (pyo3). It ships two complementary
modelling engines:
- Auto-ARIMA / SARIMA / SARIMAX — automatic order selection with real coefficient estimation by Conditional Sum of Squares (CSS).
- Prophet-style decomposition — additive/multiplicative structural models with trend changepoints, Fourier seasonalities, holidays, logistic growth and Monte-Carlo uncertainty intervals.
It has no LAPACK/BLAS/MKL dependency and needs no C toolchain — all linear algebra is implemented in Rust, so it builds cleanly on every platform.
Key Features
- Real ARIMA estimation, two ways. Coefficients are fitted by fast Conditional
Sum of Squares (default) or exact Gaussian maximum likelihood via the Kalman
filter (
EstimationMethod::Mle).auto_arimachooses the order by AIC/AICc/BIC using a stepwise (or full-grid) search, parallelized withrayon. A mean/drift term is estimated automatically, and a stationarity guard keeps fits stable. - SARIMAX. Exogenous regressors are supported end-to-end (fit and forecast).
- Uncertainty everywhere. Coefficient standard errors, 80%/95% prediction intervals from the model's exact MA(∞) forecast variance, and an optional Box-Cox/log transform (forecasts auto back-transformed).
- Diagnostics & validation. In-sample residuals feed ACF/PACF, Ljung-Box and
Jarque-Bera tests;
arima_cross_validationgives rolling-origin MAE/RMSE/MAPE. - Statistical safety. Guards against zero-variance/near-constant inputs; the Augmented Dickey-Fuller test maps its statistic through the Dickey-Fuller distribution (not a naive t-distribution).
- Serde persistence. Full JSON serialization of fitted model state.
- Python bindings.
auto_arima,SarimaModelandProphetexposed throughpyo3/numpy, PEP 561 typed (.pyistubs +py.typed).
Examples & Benchmarks
Runnable examples live in examples/:
Criterion benchmarks (auto_arima across several series sizes, plus a Prophet fit):
Results are written to target/criterion/ (HTML reports enabled). Numbers are
hardware-dependent, so none are quoted here — measure on your own machine.
Rust Usage
[]
= "0.1"
= "0.15"
= "1.0"
Auto-ARIMA & Probabilistic Forecasting
use ;
use Array1;
Prophet-style Decomposition
use ;
use ;
use Array1;
let start = from_ymd_opt.unwrap;
let dates: = .map.collect;
let y = from_shape_fn;
let mut model = new;
model.seasonality_mode = Additive;
model.add_seasonality;
model.fit.unwrap;
let prediction = model.predict.unwrap;
println!;
Model Serialization
use SarimaModel;
let json_repr = to_string?;
let restored: SarimaModel = from_str?;
Python Usage
Install (built with maturin):
# --- ARIMA ---
= +
=
=
# --- Prophet ---
=
=
=
=
Feature Flags
| Feature | Description |
|---|---|
default |
Pure-Rust library (rlib). No C toolchain or BLAS/LAPACK required. |
python |
Builds the cdylib and enables the pyo3/numpy Python extension. |
Build the Python extension locally:
License
MIT — see LICENSE.