{"id":10215,"library":"scoringrules","title":"Scoring Rules","description":"Scoringrules is a Python library for evaluating probabilistic forecasts using various scoring rules. It provides implementations of Continuous Ranked Probability Score (CRPS), Log Score, Brier Score, Dawid-Sebastiani Score, and more for various distributions and ensembles. The current version is 0.9.0, and the library maintains an active development pace with frequent minor releases and occasional breaking changes.","status":"active","version":"0.9.0","language":"en","source_language":"en","source_url":"https://github.com/frazane/scoringrules","tags":["statistics","forecasting","probabilistic-modeling","evaluation","scoring-rules"],"install":[{"cmd":"pip install scoringrules","lang":"bash","label":"Install base package"},{"cmd":"pip install scoringrules[torch]","lang":"bash","label":"Install with PyTorch backend support"},{"cmd":"pip install scoringrules[jax]","lang":"bash","label":"Install with JAX backend support"}],"dependencies":[{"reason":"Core numerical operations and array handling.","package":"numpy"},{"reason":"Statistical functions and distributions.","package":"scipy"},{"reason":"Just-In-Time (JIT) compilation for performance optimization.","package":"numba","optional":true},{"reason":"Backend for PyTorch tensor compatibility.","package":"torch","optional":true},{"reason":"Backend for JAX array compatibility.","package":"jax","optional":true}],"imports":[{"symbol":"scoringrules","correct":"import scoringrules as sr"},{"note":"While `from scoringrules import crps` works, it's generally recommended to import the top-level package or specific modules with aliases to avoid name clashes and for clearer structure.","wrong":"from scoringrules import crps","symbol":"crps","correct":"import scoringrules.crps as sr_crps"},{"symbol":"gaussian","correct":"sr.crps.gaussian(observations, mean, std)"}],"quickstart":{"code":"import numpy as np\nimport scoringrules as sr\n\n# Generate some synthetic data\nforecast_mean = np.array([0.1, 0.2, 0.3, 0.4])\nforecast_std = np.array([0.5, 0.5, 0.5, 0.5])\nobservations = np.array([0.1, 0.1, 0.3, 0.5])\n\n# Calculate CRPS for a Gaussian distribution\n# Observations must be the first argument since v0.5.0\ncrps_scores = sr.crps.gaussian(observations, forecast_mean, forecast_std)\nprint(f\"CRPS scores: {crps_scores}\")\nprint(f\"Mean CRPS: {np.mean(crps_scores)}\")\n","lang":"python","description":"This quickstart calculates the Continuous Ranked Probability Score (CRPS) for a set of Gaussian probabilistic forecasts against corresponding observations. It demonstrates the basic usage pattern with `numpy` arrays and the `crps.gaussian` function, highlighting the argument order requirement."},"warnings":[{"fix":"Ensure that `observations` are passed as the first argument to all scoring functions (e.g., `sr.crps.gaussian(observations, mean, std)`).","message":"The order of positional arguments for all scoring functions changed. Observations must now always be the first positional argument.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Consult the official documentation or release notes for v0.8.0 to identify renamed arguments and update your code accordingly. For example, some arguments like `obs` might have been explicitly renamed or absorbed into new positional schemes.","message":"Some function arguments were renamed, potentially breaking code that relied on specific keyword argument names or positional arguments that were affected by renaming.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Upgrade to version 0.7.1 or newer (`pip install --upgrade scoringrules`).","message":"Version 0.7.0 contained critical bugs. Users on this version are strongly advised to upgrade.","severity":"deprecated","affected_versions":"0.7.0"},{"fix":"This is expected behavior. Subsequent calls to the same function with similar input shapes will be significantly faster. For benchmarking, disregard the first call.","message":"When using Numba (which is a default dependency), the first call to a JIT-compiled scoring function can be noticeably slower due to the compilation process.","severity":"gotcha","affected_versions":"All versions with Numba"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Update your function call to place `observations` as the first positional argument: `sr.crps.gaussian(observations, mean, std)`.","cause":"Attempting to use pre-v0.5.0 argument order (e.g., `sr.crps.gaussian(mean, std, observations)`) where `observations` was not the first argument.","error":"TypeError: scoringrules.crps.gaussian() missing 1 required positional argument: 'observations'"},{"fix":"Pass `observations` either positionally or as a keyword argument, but not both. For clarity and consistency with post-v0.5.0 API, use `sr.crps.gaussian(observations, mean, std)`.","cause":"Passing observations both positionally (as the first argument) and as a keyword argument (e.g., `observations=...`) after v0.5.0.","error":"TypeError: scoringrules.crps.gaussian() got multiple values for argument 'observations'"},{"fix":"Check the release notes for your version or the latest documentation to find the new function name or usage pattern. For example, `crps_t` was made more robust in v0.9.0, possibly implying changes.","cause":"A specific scoring function or its name was changed or removed in a breaking release (e.g., v0.8.0 introduced refactoring and renaming).","error":"AttributeError: module 'scoringrules.crps' has no attribute 'some_old_function_name'"},{"fix":"Use the fully qualified import path: `import scoringrules.crps as sr_crps` or `import scoringrules as sr` and then access `sr.crps`.","cause":"Trying to import submodules like `crps` or `logs` directly from the top-level `scoringrules` package instead of as `scoringrules.crps`.","error":"ImportError: cannot import name 'crps' from 'scoringrules'"}]}