Skip to content

Welcome to skforecast

Python PyPI codecov Build status Project Status: Active Maintenance Downloads License DOI paypal buymeacoffee GitHub Sponsors

About The Project

Skforecast is a Python library that eases using scikit-learn regressors as single and multi-step forecasters. It also works with any regressor compatible with the scikit-learn API (LightGBM, XGBoost, CatBoost, ...).

Why use skforecast?

The fields of statistics and machine learning have developed many excellent regression algorithms that can be useful for forecasting, but applying them effectively to time series analysis can still be a challenge. To address this issue, the skforecast library provides a comprehensive set of tools for training, validation and prediction in a variety of scenarios commonly encountered when working with time series. The library is built using the widely used scikit-learn API, making it easy to integrate into existing workflows. With skforecast, users have access to a wide range of functionalities such as feature engineering, model selection, hyperparameter tuning and many others. This allows users to focus on the essential aspects of their projects and leave the intricacies of time series analysis to skforecast. In addition, skforecast is developed according to the following priorities:

  • Fast and robust prototyping. ⚡
  • Validation and backtesting methods to have a realistic assessment of model performance. 🔍
  • Models must be deployed in production. 🔨
  • Models must be interpretable. 🔮

Share Your Thoughts with Us

Thank you for choosing skforecast! We value your suggestions, bug reports and recommendations as they help us identify areas for improvement and ensure that skforecast meets the needs of the community. Please consider sharing your experiences, reporting bugs, making suggestions or even contributing to the codebase on GitHub. Together, let's make time series forecasting more accessible and accurate for everyone.

Installation

The default installation of skforecast only installs hard dependencies.

1
pip install skforecast

Specific version:

1
pip install skforecast==0.11.0

Latest (unstable):

1
pip install git+https://github.com/JoaquinAmatRodrigo/skforecast#master

Install the full version (all dependencies):

1
pip install skforecast[full]

Install optional dependencies:

1
pip install skforecast[sarimax]
1
pip install skforecast[plotting]

Dependencies

  • Python >= 3.8

Hard dependencies

  • numpy>=1.20, <1.27
  • pandas>=1.2, <2.2
  • tqdm>=4.57.0, <4.67
  • scikit-learn>=1.0, <1.4
  • optuna>=2.10.0, <3.5
  • joblib>=1.1.0, <1.4

Optional dependencies

  • matplotlib>=3.3, <3.9
  • seaborn>=0.11, <0.14
  • statsmodels>=0.12, <0.15
  • pmdarima>=2.0, <2.1

Forecasters

A Forecaster object in the skforecast library is a comprehensive container that provides essential functionality and methods for training a forecasting model and generating predictions for future points in time.

The skforecast library offers a variety of forecaster types, each tailored to specific requirements such as single or multiple time series, direct or recursive strategies, or custom predictors. Regardless of the specific forecaster type, all instances share the same API.

Forecaster Single series Multiple series Recursive strategy Direct strategy Probabilistic prediction Time series differentiation Exogenous features Custom features
ForecasterAutoreg ✔️ ✔️ ✔️ ✔️ ✔️
ForecasterAutoregCustom ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
ForecasterAutoregDirect ✔️ ✔️ ✔️ ✔️
ForecasterMultiSeries ✔️ ✔️ ✔️ ✔️
ForecasterMultiSeriesCustom ✔️ ✔️ ✔️ ✔️ ✔️
ForecasterMultiVariate ✔️ ✔️ ✔️ ✔️
ForecasterSarimax ✔️ ✔️ ✔️ ✔️ ✔️

Features

  • Create Forecasters from any regressor that follows the scikit-learn API
  • Include exogenous variables as predictors
  • Include custom predictors (rolling mean, rolling variance ...)
  • Multiple backtesting methods for model validation
  • Grid search, random search and Bayesian search to find optimal lags (predictors) and best hyperparameters
  • Prediction interval estimated by bootstrapping and quantile regression
  • Include custom metrics for model validation and grid search
  • Get predictor importance
  • Forecaster in production

Examples and tutorials

English

Skforecast: time series forecasting with Python and Scikit-learn Open In Colab

ARIMA and SARIMAX models

Forecasting with gradient boosting: XGBoost, LightGBM and CatBoost Open In Colab

Modelling time series trend with tree based models

Forecasting electricity demand with Python Open In Colab

Forecasting web traffic with machine learning and Python Open In Colab

Bitcoin price prediction with Python

Prediction intervals in forecasting models

Multi-series forecasting

Reducing the influence of Covid-19 on time series forecasting models

Forecasting time series with missing values

Intermittent demand forecasting

Stacking ensemble of machine learning models to improve forecasting

Español

Skforecast: forecasting series temporales con Python y Scikit-learn Open In Colab

Modelos ARIMA y SARIMAX

Forecasting con gradient boosting: XGBoost, LightGBM y CatBoost Open In Colab

Modelar series temporales con tendencia utilizando modelos de árboles

Forecasting de la demanda eléctrica Open In Colab

Forecasting de las visitas a una página web Open In Colab

Predicción del precio de Bitcoin con Python

Workshop predicción de series temporales con machine learning Universidad de Deusto / Deustuko Unibertsitatea

Intervalos de predicción en modelos de forecasting

Multi-series forecasting

Predicción demanda intermitente

How to contribute

Primarily, skforecast development consists of adding and creating new Forecasters, new validation strategies, or improving the performance of the current code. However, there are many other ways to contribute:

  • Submit a bug report or feature request on GitHub Issues.
  • Contribute a Jupyter notebook to our examples.
  • Write unit or integration tests for our project.
  • Answer questions on our issues, Stack Overflow, and elsewhere.
  • Translate our documentation into another language.
  • Write a blog post, tweet, or share our project with others.

For more information on how to contribute to skforecast, see our Contribution Guide.

Visit our authors section to meet all the contributors to skforecast.

Citation

If you use skforecast for a scientific publication, we would appreciate citations to the published software.

Zenodo

1
Amat Rodrigo, Joaquin, & Escobar Ortiz, Javier. (2023). skforecast (v0.11.0). Zenodo. https://doi.org/10.5281/zenodo.8382788

APA:

1
Amat Rodrigo, J., & Escobar Ortiz, J. (2023). skforecast (Version 0.11.0) [Computer software]. https://doi.org/10.5281/zenodo.8382788

BibTeX:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
@software{skforecast,
author = {Amat Rodrigo, Joaquin and Escobar Ortiz, Javier},
title = {skforecast},
version = {0.11.0},
month = {11},
year = {2023},
license = {BSD-3-Clause},
url = {https://skforecast.org/},
doi = {10.5281/zenodo.8382788}
}

Publications citing skforecast

  • OUKHOUYA, H., KADIRI, H., EL HIMDI, K., & GUERBAZ, R. (2023). Forecasting International Stock Market Trends: XGBoost, LSTM, LSTM-XGBoost, and Backtesting XGBoost Models. Statistics, Optimization & Information Computing, 12(1), 200-209. https://doi.org/10.19139/soic-2310-5070-1822

  • DUDZIK, S., & Kowalczyk, B. (2023). Prognozowanie produkcji energii fotowoltaicznej z wykorzystaniem platformy NEXO i VRM Portal. Przeglad Elektrotechniczny, 2023(11). doi:10.15199/48.2023.11.41

  • Polo J, Martín-Chivelet N, Alonso-Abella M, Sanz-Saiz C, Cuenca J, de la Cruz M. Exploring the PV Power Forecasting at Building Façades Using Gradient Boosting Methods. Energies. 2023; 16(3):1495. https://doi.org/10.3390/en16031495

  • Popławski T, Dudzik S, Szeląg P. Forecasting of Energy Balance in Prosumer Micro-Installations Using Machine Learning Models. Energies. 2023; 16(18):6726. https://doi.org/10.3390/en16186726

  • Harrou F, Sun Y, Taghezouit B, Dairi A. Artificial Intelligence Techniques for Solar Irradiance and PV Modeling and Forecasting. Energies. 2023; 16(18):6731. https://doi.org/10.3390/en16186731

  • Amara-Ouali, Y., Goude, Y., Doumèche, N., Veyret, P., Thomas, A., Hebenstreit, D., ... & Phe-Neau, T. (2023). Forecasting Electric Vehicle Charging Station Occupancy: Smarter Mobility Data Challenge. arXiv preprint arXiv:2306.06142.

  • Emami, P., Sahu, A., & Graf, P. (2023). BuildingsBench: A Large-Scale Dataset of 900K Buildings and Benchmark for Short-Term Load Forecasting. arXiv preprint arXiv:2307.00142.

  • Dang, HA., Dao, VD. (2023). Building Power Demand Forecasting Using Machine Learning: Application for an Office Building in Danang. In: Nguyen, D.C., Vu, N.P., Long, B.T., Puta, H., Sattler, KU. (eds) Advances in Engineering Research and Application. ICERA 2022. Lecture Notes in Networks and Systems, vol 602. Springer, Cham. https://doi.org/10.1007/978-3-031-22200-9_32

  • Morate del Moral, Iván (2023). Predición de llamadas realizadas a un Call Center. Proyecto Fin de Carrera / Trabajo Fin de Grado, E.T.S.I. de Sistemas Informáticos (UPM), Madrid.

  • Lopez Vega, A., & Villanueva Vargas, R. A. (2022). Sistema para la automatización de procesos hospitalarios de control para pacientes para COVID-19 usando machine learning para el Centro de Salud San Fernando.

  • García Álvarez, J. D. (2022). Modelo predictivo de rentabilidad de criptomonedas para un futuro cercano.

  • Chilet Vera, Á. (2023). Elaboración de un algoritmo predictivo para la reposición de hipoclorito en los depósitos mediante técnicas de Machine Learning (Doctoral dissertation, Universitat Politècnica de València).

  • Bustinza Barrial, A. A., Bautista Abanto, A. M., Alva Alfaro, D. A., Villena Sotomayor, G. M., & Trujillo Sabrera, J. M. (2022). Predicción de los valores de la demanda máxima de energía eléctrica empleando técnicas de machine learning para la empresa Nexa Resources–Cajamarquilla.

  • Morgado, K. Desarrollo de una técnica de gestión de activos para transformadores de distribución basada en sistema de monitoreo (Doctoral dissertation, Universidad Nacional de Colombia).

  • Zafeiriou A., Chantzis G., Jonkaitis T., Fokaides P., Papadopoulos A., 2023, Smart Energy Strategy - A Comparative Study of Energy Consumption Forecasting Machine Learning Models, Chemical Engineering Transactions, 103, 691-696.

Donating

If you found skforecast useful, you can support us with a donation. Your contribution will help to continue developing and improving this project. Many thanks! 🤗 😍


paypal

License

BSD-3-Clause License