https://github.com/nixtla/statsforecast

Lightning ⚡️ fast forecasting with statistical and econometric models.

https://github.com/nixtla/statsforecast

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary

Keywords

arima automl baselines data-science econometrics ets exponential-smoothing fbprophet forecasting machine-learning mstl naive neuralprophet predictions prophet python seasonal-naive statistics theta time-series

Keywords from Contributors

distributed agents transformers genomics parallel data-mining projection sequences climate-model unitful
Last synced: 5 months ago · JSON representation

Repository

Lightning ⚡️ fast forecasting with statistical and econometric models.

Basic Info
Statistics
  • Stars: 4,493
  • Watchers: 44
  • Forks: 328
  • Open Issues: 132
  • Releases: 37
Topics
arima automl baselines data-science econometrics ets exponential-smoothing fbprophet forecasting machine-learning mstl naive neuralprophet predictions prophet python seasonal-naive statistics theta time-series
Created about 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct

README.md

Nixtla

Tweet Slack

All Contributors

Statistical ⚡️ Forecast

Lightning fast forecasting with statistical and econometric models

[![CI](https://github.com/Nixtla/statsforecast/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/Nixtla/statsforecast/actions/workflows/ci.yaml) [![Python](https://img.shields.io/pypi/pyversions/statsforecast)](https://pypi.org/project/statsforecast/) [![PyPi](https://img.shields.io/pypi/v/statsforecast?color=blue)](https://pypi.org/project/statsforecast/) [![conda-nixtla](https://img.shields.io/conda/vn/conda-forge/statsforecast?color=seagreen&label=conda)](https://anaconda.org/conda-forge/statsforecast) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Nixtla/statsforecast/blob/main/LICENSE) [![docs](https://github.com/Nixtla/statsforecast/actions/workflows/build-docs.yaml/badge.svg)](https://github.com/Nixtla/statsforecast/actions/workflows/build-docs.yaml) [![Downloads](https://pepy.tech/badge/statsforecast)](https://pepy.tech/project/statsforecast) **StatsForecast** offers a collection of widely used univariate time series forecasting models, including automatic `ARIMA`, `ETS`, `CES`, and `Theta` modeling optimized for high performance using `numba`. It also includes a large battery of benchmarking models.

Installation

You can install StatsForecast with:

python pip install statsforecast

or

python conda install -c conda-forge statsforecast

Vist our Installation Guide for further instructions.

Quick Start

Minimal Example

```python from statsforecast import StatsForecast from statsforecast.models import AutoARIMA from statsforecast.utils import AirPassengersDF

df = AirPassengersDF sf = StatsForecast( models=[AutoARIMA(season_length=12)], freq='ME', ) sf.fit(df) sf.predict(h=12, level=[95]) ```

Get Started quick guide

Follow this end-to-end walkthrough for best practices.

Why?

Current Python alternatives for statistical models are slow, inaccurate and don't scale well. So we created a library that can be used to forecast in production environments or as benchmarks. StatsForecast includes an extensive battery of models that can efficiently fit millions of time series.

Features

  • Fastest and most accurate implementations of AutoARIMA, AutoETS, AutoCES, MSTL and Theta in Python.
  • Out-of-the-box compatibility with Spark, Dask, and Ray.
  • Probabilistic Forecasting and Confidence Intervals.
  • Support for exogenous Variables and static covariates.
  • Anomaly Detection.
  • Familiar sklearn syntax: .fit and .predict.

Highlights

  • Inclusion of exogenous variables and prediction intervals for ARIMA.
  • 20x faster than pmdarima.
  • 1.5x faster than R.
  • 500x faster than Prophet.
  • 4x faster than statsmodels.
  • Compiled to high performance machine code through numba.
  • 1,000,000 series in 30 min with ray.
  • Replace FB-Prophet in two lines of code and gain speed and accuracy. Check the experiments here.
  • Fit 10 benchmark models on 1,000,000 series in under 5 min.

Missing something? Please open an issue or write us in Slack

Examples and Guides

📚 End to End Walkthrough: Model training, evaluation and selection for multiple time series

🔎 Anomaly Detection: detect anomalies for time series using in-sample prediction intervals.

👩‍🔬 Cross Validation: robust model’s performance evaluation.

❄️ Multiple Seasonalities: how to forecast data with multiple seasonalities using an MSTL.

🔌 Predict Demand Peaks: electricity load forecasting for detecting daily peaks and reducing electric bills.

📈 Intermittent Demand: forecast series with very few non-zero observations.

🌡️ Exogenous Regressors: like weather or prices

Models

Automatic Forecasting

Automatic forecasting tools search for the best parameters and select the best possible model for a group of time series. These tools are useful for large collections of univariate time series.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |AutoARIMA|✅|✅|✅|✅|✅| |AutoETS|✅|✅|✅|✅|| |AutoCES|✅|✅|✅|✅|| |AutoTheta|✅|✅|✅|✅|| |AutoMFLES|✅|✅|✅|✅|✅| |AutoTBATS|✅|✅|✅|✅||

ARIMA Family

These models exploit the existing autocorrelations in the time series.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |ARIMA|✅|✅|✅|✅|✅| |AutoRegressive|✅|✅|✅|✅|✅|

Theta Family

Fit two theta lines to a deseasonalized time series, using different techniques to obtain and combine the two theta lines to produce the final forecasts.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |Theta|✅|✅|✅|✅|✅| |OptimizedTheta|✅|✅|✅|✅|| |DynamicTheta|✅|✅|✅|✅|| |DynamicOptimizedTheta|✅|✅|✅|✅||

Multiple Seasonalities

Suited for signals with more than one clear seasonality. Useful for low-frequency data like electricity and logs.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |MSTL|✅|✅|✅|✅|If trend forecaster supports| |MFLES|✅|✅|✅|✅|✅| |TBATS|✅|✅|✅|✅||

GARCH and ARCH Models

Suited for modeling time series that exhibit non-constant volatility over time. The ARCH model is a particular case of GARCH.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |GARCH|✅|✅|✅|✅|| |ARCH|✅|✅|✅|✅||

Baseline Models

Classical models for establishing baseline.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |HistoricAverage|✅|✅|✅|✅|| |Naive|✅|✅|✅|✅|| |RandomWalkWithDrift|✅|✅|✅|✅|| |SeasonalNaive|✅|✅|✅|✅|| |WindowAverage|✅||||| |SeasonalWindowAverage|✅|||||

Exponential Smoothing

Uses a weighted average of all past observations where the weights decrease exponentially into the past. Suitable for data with clear trend and/or seasonality. Use the SimpleExponential family for data with no clear trend or seasonality.

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |SimpleExponentialSmoothing|✅||✅||| |SimpleExponentialSmoothingOptimized|✅||✅||| |SeasonalExponentialSmoothing|✅||✅||| |SeasonalExponentialSmoothingOptimized|✅||✅||| |Holt|✅|✅|✅|✅|| |HoltWinters|✅|✅|✅|✅||

Sparse or Inttermitent

Suited for series with very few non-zero observations

|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |Exogenous features| |:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|:----------------:| |ADIDA|✅||✅|✅|| |CrostonClassic|✅||✅|✅|| |CrostonOptimized|✅||✅|✅|| |CrostonSBA|✅||✅|✅|| |IMAPA|✅||✅|✅|| |TSB|✅||✅|✅||

🔨 How to contribute

See CONTRIBUTING.md.

Citing

bibtex @misc{garza2022statsforecast, author={Azul Garza, Max Mergenthaler Canseco, Cristian Challú, Kin G. Olivares}, title = {{StatsForecast}: Lightning fast forecasting with statistical and econometric models}, year={2022}, howpublished={{PyCon} Salt Lake City, Utah, US 2022}, url={https://github.com/Nixtla/statsforecast} }

Contributors ✨

Thanks goes to these wonderful people (emoji key):

azul
azul

💻 🚧
José Morales
José Morales

💻 🚧
Sugato Ray
Sugato Ray

💻
Jeff Tackes
Jeff Tackes

🐛
darinkist
darinkist

🤔
Alec Helyar
Alec Helyar

💬
Dave Hirschfeld
Dave Hirschfeld

💬
mergenthaler
mergenthaler

💻
Kin
Kin

💻
Yasslight90
Yasslight90

🤔
asinig
asinig

🤔
Philip Gillißen
Philip Gillißen

💻
Sebastian Hagn
Sebastian Hagn

🐛 📖
Han Wang
Han Wang

💻
Ben Jeffrey
Ben Jeffrey

🐛
Beliavsky
Beliavsky

📖
Mariana Menchero García
Mariana Menchero García

💻
Nikhil Gupta
Nikhil Gupta

🐛
JD
JD

🐛
josh attenberg
josh attenberg

💻
JeroenPeterBos
JeroenPeterBos

💻
Jeroen Van Der Donckt
Jeroen Van Der Donckt

💻
Roymprog
Roymprog

📖
Nelson Cárdenas Bolaño
Nelson Cárdenas Bolaño

📖
Kyle Schmaus
Kyle Schmaus

💻
Akmal Soliev
Akmal Soliev

💻
Nick To
Nick To

💻
Kevin Kho
Kevin Kho

💻
Yiben Huang
Yiben Huang

📖
Andrew Gross
Andrew Gross

📖
taniishkaaa
taniishkaaa

📖
Manuel Calzolari
Manuel Calzolari

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Owner

  • Name: Nixtla
  • Login: Nixtla
  • Kind: organization
  • Email: ops@nixtla.io
  • Location: United States of America

Open Source Time Series Ecosystem

GitHub Events

Total
  • Create event: 42
  • Release event: 3
  • Issues event: 55
  • Watch event: 523
  • Delete event: 33
  • Member event: 1
  • Issue comment event: 183
  • Push event: 177
  • Pull request review comment event: 28
  • Pull request review event: 50
  • Pull request event: 102
  • Fork event: 43
Last Year
  • Create event: 42
  • Release event: 3
  • Issues event: 55
  • Watch event: 523
  • Delete event: 33
  • Member event: 1
  • Issue comment event: 183
  • Push event: 177
  • Pull request review comment event: 28
  • Pull request review event: 50
  • Pull request event: 102
  • Fork event: 43

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,168
  • Total Committers: 50
  • Avg Commits per committer: 23.36
  • Development Distribution Score (DDS): 0.367
Past Year
  • Commits: 79
  • Committers: 13
  • Avg Commits per committer: 6.077
  • Development Distribution Score (DDS): 0.532
Top Committers
Name Email Commits
FedericoGarza f****z@g****m 739
José Morales j****2@g****m 144
allcontributors[bot] 4****] 58
mergenthaler m****m@g****m 55
Kin k****s@g****m 38
dependabot[bot] 4****] 26
Mariana Menchero García 4****o 26
Kevin Kho k****o@g****m 12
Akmal Soliev s****v@g****m 8
Han Wang h****g@l****m 5
Hahnbee Lee 5****e 4
shibzhou s****3@g****m 4
Akmal Soliev a****v@n****t 3
Andrew Scott 8****m 3
taniishkaaa 1****a 2
Yiben Huang 6****g 2
Vaibhav Gupta 9****t 2
Sugato Ray r****o@g****m 2
Nelson Cárdenas Bolaño n****8@g****m 2
Jeroen Bos j****n@l****c 2
Manuel Calzolari m****i@g****m 2
Manishankar Singh m****7@g****m 1
Kyle Schmaus k****s@g****m 1
Matheus Fidelis m****s 1
Josh Attenberg j****g@g****m 1
Chad Parmet c****t@g****m 1
Christopher Titchen 1****n 1
Cristian c****u@g****m 1
westonplatter w****b@g****m 1
r r****l 1
and 20 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 247
  • Total pull requests: 423
  • Average time to close issues: 3 months
  • Average time to close pull requests: 12 days
  • Total issue authors: 173
  • Total pull request authors: 58
  • Average comments per issue: 1.91
  • Average comments per pull request: 1.58
  • Merged pull requests: 331
  • Bot issues: 1
  • Bot pull requests: 73
Past Year
  • Issues: 46
  • Pull requests: 148
  • Average time to close issues: 11 days
  • Average time to close pull requests: 3 days
  • Issue authors: 37
  • Pull request authors: 21
  • Average comments per issue: 0.41
  • Average comments per pull request: 1.82
  • Merged pull requests: 102
  • Bot issues: 1
  • Bot pull requests: 56
Top Authors
Issue Authors
  • nelsoncardenas (9)
  • AzulGarza (6)
  • FedericoGarza (6)
  • Jonathan-87 (5)
  • vspinu (5)
  • jmoralez (5)
  • quant5 (4)
  • sammiller06 (4)
  • andrewscottm (4)
  • GGA-PERSO (4)
  • kgboyko (4)
  • tackes (4)
  • RashidBakirov (3)
  • sm-ak-r33 (3)
  • Chaptyziok (3)
Pull Request Authors
  • jmoralez (141)
  • dependabot[bot] (62)
  • FedericoGarza (47)
  • MMenchero (23)
  • allcontributors[bot] (11)
  • kvnkho (11)
  • akmalsoliev (10)
  • deven367 (8)
  • andrewscottm (6)
  • nepslor (6)
  • elephaint (6)
  • AzulGarza (5)
  • tracykteal (4)
  • dimbleby (4)
  • mergenthaler (4)
Top Labels
Issue Labels
bug (84) enhancement (60) feature (51) documentation (31) awaiting response (23) dependencies (3) arima (2) good first issue (2) help wanted (1) question (1)
Pull Request Labels
dependencies (72) fix (60) enhancement (43) documentation (43) feature (13) github_actions (12) breaking change (5) bug (3)

Dependencies

dev/environment.yml conda
  • holidays <0.21
  • jupyterlab
  • matplotlib
  • numba >=0.55.0
  • numpy >=1.21.6
  • pandas >=1.3.5
  • pip
  • plotly
  • prophet
  • pyarrow
  • pyspark >=3.3
  • scipy >=1.7.3
  • statsmodels >=0.13.2
  • tabulate
  • utilsforecast >=0.0.5
experiments/arima/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • pmdarima
  • prophet
  • python 3.7.*
  • r-base 3.6.3
  • r-forecast
  • r-furrr
  • r-future
  • r-future.apply
  • r-tidyverse
  • r-urca
  • scikit-learn
  • tabulate
experiments/arima_prophet_adapter/environment.yml conda
  • prophet
  • python 3.7.*
experiments/arima_xreg/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • pmdarima
  • prophet
  • python 3.7.*
  • r-base 3.6.3
  • r-forecast
  • r-furrr
  • r-future
  • r-future.apply
  • r-tidyverse
  • r-urca
  • scikit-learn
  • tabulate
experiments/benchmarks_at_scale/environment.yml conda
  • fire
  • jupyterlab
  • pip 20.3.3
  • pyarrow
  • python 3.7.*
experiments/ces/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • prophet
  • python 3.7.*
  • r-base
  • r-nloptr
  • scikit-learn
  • tabulate
experiments/ets/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • pmdarima
  • prophet
  • python 3.7.*
  • r-base 3.6.3
  • r-forecast
  • r-furrr
  • r-future
  • r-future.apply
  • r-tidyverse
  • r-urca
  • scikit-learn
  • tabulate
experiments/ets_intervals/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • pmdarima
  • prophet
  • python 3.7.*
  • r-base 3.6.3
  • r-forecast
  • r-furrr
  • r-future
  • r-future.apply
  • r-tidyverse
  • r-urca
  • scikit-learn
  • tabulate
experiments/m3/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • python 3.7.*
  • scikit-learn
  • tabulate
experiments/mstl/environment.yml conda
  • fire
  • numba
  • numpy
  • pip 20.3.3
  • prophet
  • python 3.8.*
experiments/neuralprophet/environment.yml conda
  • fire
  • numba
  • numpy
  • pip 20.3.3
  • python 3.8.*
experiments/ray_ets/environment.yml conda
  • numpy 1.21.4
  • pip 20.3.3
  • python 3.7.*
experiments/theta/environment.yml conda
  • fire
  • numba
  • numpy 1.21.4
  • pip 20.3.3
  • python 3.7.*
  • scikit-learn
  • tabulate
setup.py pypi
.github/workflows/ci.yaml actions
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
  • mamba-org/setup-micromamba v1 composite
.github/workflows/deploy.yaml actions
  • fastai/workflows/quarto-ghp master composite
.github/workflows/lint.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/no-response.yaml actions
  • lee-dohm/no-response v0.5.0 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
dev/Dockerfile docker
  • python 3.10 build
experiments/arima/Dockerfile docker
  • continuumio/miniconda3 4.7.12 build
experiments/arima_xreg/Dockerfile docker
  • continuumio/miniconda3 4.7.12 build
experiments/ces/Dockerfile docker
  • continuumio/miniconda3 4.7.12 build
dev/requirements.txt pypi
  • holidays <0.21 development
  • jupyterlab * development
  • matplotlib * development
  • nbdev * development
  • numba >=0.55.0 development
  • numpy >=1.21.6 development
  • pandas >=1.3.5 development
  • pip * development
  • plotly * development
  • plotly-resampler * development
  • polars * development
  • prophet * development
  • scipy >=1.7.3 development
  • statsmodels >=0.13.2 development
  • supersmoother * development
  • tabulate * development
  • tqdm * development