| Package | |
| Meta | |
| Testing | |
| Community |
About skforecast
Time series forecasting, from prototype to production. Skforecast is a Python library for time series forecasting using scikit-learn compatible models, statistical methods, and foundation models. It works with any estimator compatible with the scikit-learn API, such as LightGBM, XGBoost, CatBoost or Keras.
Backtesting of LightGBM, Chronos-2 and ARIMA on daily electricity demand, with temperature and holidays as exogenous variables. Real skforecast outputs, from the animation on skforecast.org.
Installation
pip install skforecast
Also available on conda-forge (conda install -c conda-forge skforecast). Optional dependencies for statistical models, plotting and deep learning are listed in the installation guide.
Quick example
from lightgbm import LGBMRegressor
from skforecast.recursive import ForecasterRecursive
from skforecast.datasets import load_demo_dataset
# Download demo dataset
y = load_demo_dataset()
# Create and fit the forecaster using the last 15 observations as features
forecaster = ForecasterRecursive(
estimator = LGBMRegressor(random_state=123, verbose=-1),
lags = 15
)
forecaster.fit(y=y)
# Predict the next 12 months
predictions = forecaster.predict(steps=12)
predictions.head()
# 2008-07-01 0.976355
# 2008-08-01 1.038296
# 2008-09-01 1.108676
# 2008-10-01 1.163778
# 2008-11-01 1.169646
# Freq: MS, Name: pred, dtype: float64
Same workflow with a foundation model (Chronos-2, zero-shot)
# pip install chronos-forecasting
from skforecast.foundation import FoundationModel, ForecasterFoundation
from skforecast.datasets import load_demo_dataset
# Download demo dataset
y = load_demo_dataset()
# Create the forecaster: fit only stores the context, there is no training
forecaster = ForecasterFoundation(
estimator = FoundationModel("autogluon/chronos-2-small")
)
forecaster.fit(series=y)
# Predict the next 12 months
predictions = forecaster.predict(steps=12)
predictions.head()
# level pred
# 2008-07-01 y 1.002536
# 2008-08-01 y 1.030961
# 2008-09-01 y 1.083664
# 2008-10-01 y 1.184066
# 2008-11-01 y 1.170530
Features
One API for every kind of model
- Machine learning: any scikit-learn compatible regressor, such as LightGBM, XGBoost or CatBoost, with lags, rolling and calendar features. Recursive or direct strategies, for one series or thousands.
- Foundation models: zero-shot forecasting with pre-trained models such as Chronos-2, TimesFM, Moirai-2 or TabPFN-TS, without training them.
- Statistical models: ARIMA, SARIMAX, ETS and ARAR, with automatic model selection.
- Deep learning: recurrent neural networks (RNN, LSTM) built with Keras.
Train, predict, tune and backtest the same way, whatever the model.
Built for production
- Backtesting that reproduces how the model will be used: refits, gaps, fold strides, fixed or expanding windows.
- Probabilistic forecasting with bootstrapping, conformal prediction and quantiles, evaluated with CRPS and coverage.
- Hyperparameter tuning with grid, random and Bayesian search (Optuna), including the number of lags.
- Feature engineering: rolling statistics, calendar features, exogenous and categorical variables, and differentiation.
- Global models that forecast many series with one model, even with different lengths, exogenous variables and missing values.
- Explainability and monitoring: feature importances and SHAP values, feature selection and drift detection.
Forecasters
All forecasters share the same API for training, prediction, backtesting and probabilistic forecasting.
| Forecaster | Estimator | Series | Strategy | Exog | Window features | Differentiation |
|---|---|---|---|---|---|---|
| ForecasterRecursive | scikit-learn regressor | single | recursive | ✓ | ✓ | ✓ |
| ForecasterDirect | scikit-learn regressor | single | direct | ✓ | ✓ | ✓ |
| ForecasterRecursiveMultiSeries | scikit-learn regressor | multiple | recursive | ✓ | ✓ | ✓ |
| ForecasterDirectMultiVariate | scikit-learn regressor | multiple | direct | ✓ | ✓ | ✓ |
| ForecasterFoundation | pre-trained, zero-shot | single or multiple | multi-output | ✓ | ||
| ForecasterStats | Arima, Sarimax, Ets, Arar | single | recursive | ✓ | ||
| ForecasterRnn | Keras model (RNN/LSTM) | single or multiple | multi-output | ✓ | ||
| ForecasterRecursiveClassifier | scikit-learn classifier | single | recursive | ✓ | ✓ | |
| ForecasterEquivalentDate | Rule-based (baseline) | single | recursive |
Documentation
The full documentation is available at https://skforecast.org.
| Documentation | |
|---|---|
| 📖 Introduction to forecasting | Forecasting concepts and how to choose a forecaster |
| 🚀 Quick start | Install skforecast and train your first model |
| 🛠️ User guides | Detailed guides on every feature |
| 🎓 Examples and tutorials | Practical examples, in English, Spanish and Chinese |
| ❓ FAQ and tips | Answers and tips about forecasting |
| 📚 API Reference | Reference for all functions and classes |
| 📝 Releases | What changed in each version |
AI and tools
- AI-assisted coding: skforecast publishes machine-readable context files so AI assistants (ChatGPT, Claude, Copilot and others) generate accurate code. Paste
https://skforecast.org/latest/llms-full.txtinto any LLM, or install the workflow skills in your coding agent: as a Claude Code plugin (/plugin marketplace add skforecast/skforecast) or withnpx skills add skforecast/skforecastfor Cursor, Copilot, Codex and others. Learn more in AI-assisted forecasting. - skforecast-ai: an AI forecasting assistant that pairs a deterministic engine, powered by skforecast, with an LLM reasoning layer. Install it with
pip install skforecast-ai. - Skforecast Studio: a no-code application to build forecasting models visually, which generates production-ready Python code.
Contributing
Bug reports, feature requests, code, tests, documentation and examples are all welcome. Open an issue on GitHub Issues or read the Contribution Guide to get started.
skforecast is created and maintained by Joaquín Amat Rodrigo and Javier Escobar Ortiz, together with everyone who has contributed to it (about the project).
Citation
If you use skforecast in a scientific publication, please cite the version you used: each version has its own DOI and ready-made citations on Zenodo. To cite skforecast in general, use the DOI that always resolves to the latest release.
APA:
Amat Rodrigo, J., & Escobar Ortiz, J. skforecast [Computer software]. https://doi.org/10.5281/zenodo.8382787
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}
}
The citation metadata is also in CITATION.cff (GitHub's "Cite this repository" button). skforecast is used in 70+ scientific publications: see them on Google Scholar.
Sponsorship and funding
skforecast is free, open-source software supported by the Sovereign Tech Fund and by the organizations that sponsor it. If your company relies on skforecast, see Sponsorship and funding for sponsorship tiers, support agreements, feature sponsorship and training.
Individuals can support the project through Open Collective, Buy Me a Coffee, GitHub Sponsors (Joaquín Amat Rodrigo, Javier Escobar Ortiz) or PayPal.
License
Skforecast software: BSD-3-Clause License
Skforecast documentation: CC BY-NC-SA 4.0
Trademark: The trademark skforecast is registered with the European Union Intellectual Property Office (EUIPO) under the application number 019109684. Unauthorized use of this trademark, its logo, or any associated visual identity elements is strictly prohibited without the express consent of the owner.
Metadata
Release files for skforecast 0.26.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| skforecast-0.26.0.tar.gz | 541.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| skforecast-0.26.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / skforecast-0.26.0.tar.gz
| Download URL | skforecast-0.26.0.tar.gz |
|---|---|
| Size | 541.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0fe8850c721589aa54a0214cba5eb63cf7dbbdecfe30abec96b18f00724c1e9
|
|
BLAKE2b-256 checksum How to use checksums |
ee310a2b7c332ad40bac2e37c79780ae161530c70193c22e0ca49c3e33ee3a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / skforecast-0.26.0-py3-none-any.whl
| Download URL | skforecast-0.26.0-py3-none-any.whl |
|---|---|
| Size | 567.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e69d81bc84f43b098585c90229728ddb762cb80172f30e8d5be4487f77bad436
|
|
BLAKE2b-256 checksum How to use checksums |
44464cef0c93c079e0a928913461d6b597513cde45f61f93297266ca65d9e664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|