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.11!

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.10.0.tar.gz (241.6 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.10.0-py3-none-any.whl (96.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scoringrules-0.10.0.tar.gz
  • Upload date:
  • Size: 241.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","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.10.0.tar.gz
Algorithm Hash digest
SHA256 a92ea7863f0ce09820af3e5e66166de2c65ad06026bafbb45293a84780526e30
MD5 2af71d0733a986a392bd88a62821202f
BLAKE2b-256 2bf93d13e71ad2ad0b2e278b95980550425a4d8b042fffd3510f79b1d882409a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scoringrules-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 96.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","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.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b29d3489e62e830cb4e321c4d070e3099c148097f21b2bc4eb0fce4f6bd6a248
MD5 6295096244eb4e5824ec6a5d52821bb1
BLAKE2b-256 de435fc16b8491a2c6c3af1623701f30011d8e40f872acfe40b3fa25abcc5060

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