Skip to main content

Scoring rules for probabilistic forecast evaluation.

Project description

dark banner light banner

Probabilistic forecast evaluation

CI codecov pypi

scoringrules is a python library that provides scoring rules to evaluate probabilistic forecasts. It's original goal was to reproduce the functionality of the R package scoringRules in python, thereby allowing forecasting practitioners working in python to enjoy the same tools as those working in R. The methods implemented in scoringrules are therefore based around those available in scoringRules, which are rooted in the scientific literature on probabilistic forecasting.

The scoring rules available in scoringrules include, but are not limited to, the

  • Brier Score
  • Logarithmic Score
  • (Discrete) Ranked Probability Score
  • Continuous Ranked Probability Score (CRPS)
  • Dawid-Sebastiani Score
  • Energy Score
  • Variogram Score
  • Gaussian Kernel Score
  • Threshold-Weighted CRPS
  • Threshold-Weighted Energy Score

Features

  • Fast computation of several probabilistic univariate and multivariate verification metrics
  • Multiple backends: support for numpy (accelerated with numba), jax, pytorch and tensorflow
  • Didactic approach to probabilistic forecast evaluation through clear code and documentation

Installation

Requires python >=3.10!

pip install scoringrules

Documentation

Learn more about scoringrules in its official documentation at https://scoringrules.readthedocs.io/en/latest/.

Quick example

import scoringrules as sr
import numpy as np

obs = np.random.randn(100)
fct = obs[:,None] + np.random.randn(100, 21) * 0.1
sr.crps_ensemble(obs, fct)

Citation

If you found this library useful, consider citing:

@software{zanetta_scoringrules_2024,
  author = {Francesco Zanetta and Sam Allen},
  title = {scoringrules: a python library for probabilistic forecast evaluation},
  year = {2024},
  url = {https://github.com/frazane/scoringrules}
}

Acknowledgements

  • The widely-used R package scoringRules served as a reference for this library, which greatly facilitated our work. We are additionally grateful for fruitful discussions with the authors.
  • The quality of this library has also benefited a lot from discussions with (and contributions from) Nick Loveday and Tennessee Leeuwenburg, whose python library scores similarly provides a comprehensive collection of forecast evaluation methods.

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

scoringrules-0.8.0.tar.gz (191.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scoringrules-0.8.0-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

Details for the file scoringrules-0.8.0.tar.gz.

File metadata

  • Download URL: scoringrules-0.8.0.tar.gz
  • Upload date:
  • Size: 191.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for scoringrules-0.8.0.tar.gz
Algorithm Hash digest
SHA256 5acff380f1a1957d2a84fd9b247d8892cd33cdc4d7fcd70f2fb6e1ffedbebb68
MD5 15b65a08c44375c97a6453378a18082e
BLAKE2b-256 59702fc70d2bd22319406d0fbd96acb75fd579fb8e1ddad9c0cdfcb93fe4f4b4

See more details on using hashes here.

File details

Details for the file scoringrules-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: scoringrules-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 77.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for scoringrules-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98eafc66fe83143d88da4b53d544896823390fdad01c9fd49424469eced3a716
MD5 173a92804ba137dde3f8888c5c19a589
BLAKE2b-256 3d03941d4c31846e8a56f36e824a2b183d8a0896d54d2c5cdc59fa87b588e6d7

See more details on using hashes here.

Supported by

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