Skip to main content

Forecasting time series with scikit-learn regressors. It also works with any regressor compatible with the scikit-learn API (pipelines, CatBoost, LightGBM, XGBoost, Ranger...).

Project description


Python PyPI codecov Build status Project Status: Active Maintenance License Downloads

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. :zap:
  • Validation and backtesting methods to have a realistic assessment of model performance. :mag:
  • Models must be deployed in production. :hammer:
  • Models must be interpretable. :crystal_ball:

Documentation: https://skforecast.org :books:

Installation

The default installation of skforecast only installs hard dependencies.

pip install skforecast

Specific version:

pip install skforecast==0.8.1

Latest (unstable):

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

Install the full version (all dependencies):

pip install skforecast[full]

Install optional dependencies:

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

Dependencies

  • Python >= 3.8

Hard dependencies

  • numpy>=1.20, <1.25
  • pandas>=1.2, <2.1
  • tqdm>=4.57.0, <4.65
  • scikit-learn>=1.0, <1.3
  • optuna>=2.10.0, <3.2
  • joblib>=1.1.0, <1.3.0

Optional dependencies

  • matplotlib>=3.3, <3.8
  • seaborn>=0.11, <0.13
  • statsmodels>=0.12, <0.14
  • pmdarima>=2.0, <2.1

Features

  • Create recursive autoregressive forecasters from any regressor that follows the scikit-learn API
  • Create direct autoregressive forecasters from any regressor that follows the scikit-learn API
  • Create multi-series autoregressive 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
  • Include custom metrics for model validation and grid search
  • Prediction interval estimated by bootstrapping and quantile regression
  • Get predictor importance
  • Forecaster in production

What is new in skforecast 0.8.1?

  • Support for pandas 2.0.x.
  • New user guide on how to include categorical variables in the Forecasters.
  • New user guide on how to use GPU in Google Colab with XGBoost and LightGBM regressors.
  • Include custom kwargs during fit.
  • The dtypes of exogenous variables are maintained when generating the training matrices with the create_train_X_y method in all the Forecasters.
  • Include gap argument in backtesting functions to omit observations between training and prediction.
  • Bug fixes and performance improvements.

Visit the release notes to view all notable changes.

Documentation

The documentation for the latest release is at skforecast docs.

Recent improvements are highlighted in the release notes.

Examples and tutorials

English

Español

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

How to contribute

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

Citation

If you use this software, please cite it using the following metadata.

APA:

Amat Rodrigo, J., & Escobar Ortiz, J. skforecast (Version 0.8.1) [Computer software]

BibTeX:

@software{skforecast,
author = {Amat Rodrigo, Joaquin and Escobar Ortiz, Javier},
license = {MIT},
month = {5},
title = {{skforecast}},
version = {0.8.1},
year = {2023}
}

View the citation file.

License

BSD 3-Clause License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skforecast-0.8.1.tar.gz (265.5 kB view details)

Uploaded Source

Built Distribution

skforecast-0.8.1-py2.py3-none-any.whl (386.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file skforecast-0.8.1.tar.gz.

File metadata

  • Download URL: skforecast-0.8.1.tar.gz
  • Upload date:
  • Size: 265.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for skforecast-0.8.1.tar.gz
Algorithm Hash digest
SHA256 0e8c475e501a0b87699c976737ae35ded5250bd83458d6651800d7ff7d3be990
MD5 030c40d6d56e26bd09c1abeae5ea8a53
BLAKE2b-256 5cec239ee2f03833a427d42e5c15d9454bbb6f50efefbedd3590c00bf14df388

See more details on using hashes here.

File details

Details for the file skforecast-0.8.1-py2.py3-none-any.whl.

File metadata

  • Download URL: skforecast-0.8.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 386.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for skforecast-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bea9a2f7b22bfeae1bddf50e69aec8ad80cec8536593f4d82771414739130bef
MD5 2756f024d2b4f3a665dc31a5949c694a
BLAKE2b-256 0d9b0757ed70ab89a43e8664584e03a7f4e7483824983b4eed565af178b3172e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page