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.9.0.tar.gz (194.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.9.0-py3-none-any.whl (83.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scoringrules-0.9.0.tar.gz
  • Upload date:
  • Size: 194.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"SLES","version":"15.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for scoringrules-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2c25604d00349d8890e7e52bb9e77cd9e28b2ba5df463c4b986122707d36be3c
MD5 3413b932e6cea9e74c280a41d5e76243
BLAKE2b-256 792ed9b3907434f1deb6a3e14d6b59d775772c5a4aed2f1cef8f2dc7e5b86403

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scoringrules-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 83.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"SLES","version":"15.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for scoringrules-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 575f0067ab552b51c91aebb33817a580591cdbf6a3d4c76d5166739a3d620bcc
MD5 20abf5c34e0fe32bb6b0174bb9a18887
BLAKE2b-256 f9cc5b30f5125183e835d192679a14b1c5990fd38f7f75e8776446f4922e602e

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