Open-source Python library

Time series forecasting, from prototype to production

Python library for time series forecasting using scikit-learn compatible models, statistical methods, and foundation models.

Get started User guides GitHub
$ pip install skforecast
Daily electricity demand in Victoria, Australia, with 56-day forecasts from LightGBM, Chronos-2 and ARIMA, their backtesting predictions, and daily maximum temperature 1602002402801030Jul 2014AugSepOctNovDec FOLD 1FOLD 2 FORECAST HORIZON, 56 DAYS MAX TEMPERATURE, °C

Your series and what drives it

Daily electricity demand in Victoria, Australia, with temperature and public holidays as exogenous variables.

Frequency
Daily
Period
2012 to 2014
Observations
1,096 days
Unit
GWh per day
Exogenous
Temperature, holidays
from skforecast.datasets import fetch_dataset

data = fetch_dataset("vic_electricity")  # aggregated to daily
y, exog = data["demand"], data[["temperature", "holiday"]]
Every forecast in this animation is a real skforecast output, not a drawing. How this animation was made

Daily electricity demand in Victoria, Australia (the half-hourly vic_electricity dataset, aggregated to daily totals). Models are fitted on data up to 5 November 2014 and evaluated on the last 56 days of the dataset. Temperature is treated as known in advance, as it would be with a weather forecast. The three models use the same exogenous variables, and the settings of LightGBM and ARIMA were chosen on an earlier validation period. The code is simplified for display; see the Quick start for complete examples.

BSD-3 open-source license NumFOCUS and GC.OS affiliated Funded by the Sovereign Tech Fund Used in 70+ scientific publications Developed since 2021
Models

One API for every kind of model

Train, predict, tune and backtest the same way, whether the model is a gradient boosting regressor, a pre-trained foundation model or a classical statistical model.

Machine learning

Any scikit-learn compatible model

Turn any regressor into a forecaster with lags, rolling and calendar features. Recursive or direct, one series or thousands.

LightGBMXGBoostCatBoostscikit-learn
Recursive forecasting →
Foundation models

Zero-shot forecasting

Forecast with pre-trained models without training them, and evaluate them with the same backtesting as any other model.

Chronos-2TimesFMMoirai-2TabPFN-TS+5
Foundation models →
Statistical

Proven statistical models

ARIMA, SARIMAX, ETS and ARAR with automatic model selection, in the same interface as the rest.

ARIMAETSSARIMAXARAR
Statistical models →
Deep learning

Recurrent neural networks

RNN and LSTM architectures built with Keras for single and multiple series.

Not sure which one to use? Compare all forecasters in the Introduction to forecasting.

Global models

One model for thousands of series

Train a single model on all your series at once. It learns patterns shared across products, stores or sensors, and it forecasts new or short series that a model per series cannot handle.

  • Machine learning global models with ForecasterRecursiveMultiSeries and ForecasterDirectMultiVariate.
  • Foundation models forecast many series in one call with ForecasterFoundation.
  • Real-world data: series of different lengths, their own exogenous variables and missing values.
Global forecasting guide
36 of the 304 quarterly series of the Australian tourism dataset (overnight trips by region and purpose), picked at random. Orange: 8-quarter forecasts from a single LightGBM model trained once on all 304 series.
Code

Change the model, keep your pipeline

Moving from a linear model to gradient boosting or to a foundation model takes a couple of lines. Everything around it stays the same.

  • Familiar API. fit, predict and predict_interval, like scikit-learn.
  • pandas in, pandas out. Dates and frequencies are handled for you.
  • Comparable results. Every model goes through the same backtesting.
forecast.py
from sklearn.linear_model import Ridge
from skforecast.recursive import ForecasterRecursiveforecaster = ForecasterRecursive(
    estimator=Ridge(),
    lags=12
)forecaster.fit(y=y)
predictions = forecaster.predict(steps=12)
Production

Built for forecasts you can trust

The tools you need to go from a promising notebook to a model you can defend in front of your team.

Backtesting

Validation that reproduces how the model will be used: refits, gaps, fold strides, fixed or expanding windows.

Learn more about backtesting →

Probabilistic forecasting

Prediction intervals with bootstrapping, conformal prediction and quantiles, evaluated with CRPS and coverage.

Learn more about probabilistic forecasting →

Hyperparameter tuning

Grid, random and Bayesian search with Optuna, including the number of lags.

Learn more about hyperparameter tuning →

Feature engineering

Rolling statistics, calendar features, exogenous and categorical variables, and differentiation.

Learn more about feature engineering →

Explainability

Feature importances and SHAP values to understand what drives each forecast.

Learn more about explainability →

Monitoring

Select the features that matter and detect data drift once the model is deployed.

Learn more about monitoring →
AI

Ready for AI assistants and agents

Use skforecast from your AI coding assistant, through an agent, or without writing code.

For your assistant

Accurate code from any LLM

Machine-readable context files and agent skills, so ChatGPT, Claude, Copilot and others write correct, up-to-date skforecast code.

skforecast.org/latest/llms-full.txt
AI-assisted forecasting →
Agentic forecasting

skforecast-ai

An AI forecasting assistant that pairs a deterministic engine, powered by skforecast, with an LLM reasoning layer.

pip install skforecast-ai
Try skforecast-ai →
No code

Skforecast Studio

Build and evaluate forecasting models visually, and export production-ready Python code.

Launch Studio →
Open source

Independent and sustainably funded

skforecast is free, BSD-3 licensed software, maintained by a small core team and supported by public funding and sponsors.

Sovereign Tech Fund. Service agreement to maintain skforecast as open digital infrastructure.

NumFOCUS affiliated project, alongside the scientific Python ecosystem.

GC.OS affiliated project, the German Center for Open Source AI.

Research

Cite skforecast

If you use skforecast in a scientific publication, please cite the version you used.

Amat Rodrigo, J., & Escobar Ortiz, J. skforecast [Computer software].
https://doi.org/10.5281/zenodo.8382787

This DOI always resolves to the latest release. Each version has its own DOI and ready-made citations on Zenodo. The citation metadata is also in CITATION.cff, which GitHub offers as "Cite this repository".

BibTeX
@software{skforecast,
  author  = {Amat Rodrigo, Joaquin and Escobar Ortiz, Javier},
  title   = {skforecast},
  license = {BSD-3-Clause},
  url     = {https://skforecast.org/},
  doi     = {10.5281/zenodo.8382787}
}

skforecast is used in 70+ scientific publications. See them on Google Scholar →

Built and maintained by

About skforecast →
Joaquín Amat Rodrigo
Co-creator and core developer
Javier Escobar Ortiz
Co-creator and core developer