$ show Nixtla/statsforecast
StatsForecast is a production-grade Python library for large-scale statistical time series forecasting. It provides a scikit-learn-like API (fit/predict) with over 30 models including AutoARIMA, AutoETS, AutoCES, AutoTheta, TBATS, MSTL, GARCH, and intermittent demand models. The library achieves high performance through a hybrid architecture: core algorithms are implemented in C++ using Eigen and pybind11, while Python handles orchestration, model selection, and validation. It supports distributed computing via Fugue (Spark, Dask, Ray) and multiprocessing, enabling forecasting on millions of time series. The library also includes conformal prediction intervals, cross-validation, simulation, and feature engineering utilities. While primarily an application library, the repository has a strong research component with extensive benchmarking experiments against R's forecast package, pmdarima, Prophet, NeuralProphet, and Amazon Forecast. These experiments are well-documented with reproducible environments (Docker, conda, Makefiles) and use public datasets (M3, M4, M5, Tourism, ERCOT). The codebase is actively maintained with CI/CD across multiple OS/Python versions, automated wheel building, and documentation pipelines using Quarto and Mintlify. The architecture is clean and modular: models inherit from a common base class (_TS), distributed backends implement a ParallelBackend interface, and C++ code is separated into submodules. Notable reusable components include a generic Nelder-Mead optimizer, a unified distribution framework, and a stepwise ARIMA search algorithm ported from R. The library is well-tested with comprehensive unit and integration tests.
The LLM identified 5 files worth highlighting for reuse:
A generic Nelder-Mead simplex optimizer implemented in C++ using Eigen. Used by ETS and Theta models for parameter estimation. Self-contained header with no external dependencies beyond Eigen. Demonstrates clean C++ optimization pattern that could be extracted for any optimization task.
Unified C++ header defining five error distributions (Normal, Laplace, Student-t, SkewNormal, GED) with neg-log-likelihood functions. Used across ARIMA, ETS, CES, and Theta models. Demonstrates a reusable distribution framework that can be extended with new distributions.
Pure-Python implementation of R's auto.arima algorithm, including stepwise search, unit root tests (KPSS, seasonal strength), and support for non-normal error distributions. The stepwise ARIMA search algorithm is a non-trivial, self-contained component that could be reused in other forecasting libraries or adapted for model selection in different contexts.
Provides mstl_decomposition function to extract trend and seasonal components from time series using MSTL (Multiple Seasonal-Trend decomposition). These components can be used as external regressors in forecasting models. Demonstrates a clean pattern for feature extraction that is reusable across different time series datasets.
Implements FugueBackend, a distributed computing backend that allows the same StatsForecast code to run on pandas, Dask, Spark, or Ray without modification. Demonstrates the adapter pattern for distributed execution, with automatic detection of the input DataFrame type. Reusable pattern for any library needing distributed execution.