Skip to main content

Scores is a package containing mathematical functions for the verification, evaluation and optimisation of forecasts, predictions or models.

Project description

scores: Verification and Evaluation for Forecasts and Models

CodeQL Coverage Status Binder

A list of over 50 metrics, statistical techniques and data processing tools contained in scores is available here.

scores is a Python package containing mathematical functions for the verification, evaluation and optimisation of forecasts, predictions or models. It supports labelled n-dimensional (multidimensional) data, which is used in many scientific fields and in machine learning. At present, scores primarily supports the geoscience communities; in particular, the meteorological, climatological and oceanographic communities.

Documentation is hosted at scores.readthedocs.io.
Source code is hosted at github.com/nci/scores.
The tutorial gallery is hosted at as part of the documentation, here.

Overview

Here is a curated selection of the metrics, tools and statistical tests included in scores:

Description Selection of Included Functions
Continuous Scores for evaluating single-valued continuous forecasts. Mean Absolute Error (MAE), Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Additive Bias, Multiplicative Bias, Pearson's Correlation Coefficient, Flip-Flop Index, Quantile Loss, Murphy Score, families of consistent scoring functions for quantiles and expectiles.
Probability Scores for evaluating forecasts that are expressed as predictive distributions, ensembles, and probabilities of binary events. Brier Score, Continuous Ranked Probability Score (CRPS) for Cumulative Density Function (CDF), Threshold weighted CRPS for CDF, CRPS for ensembles, Receiver Operating Characteristic (ROC), Isotonic Regression (reliability diagrams).
Categorical Scores (including contingency table metrics) for evaluating forecasts of categories. Probability of Detection (POD), False Alarm Ratio (FAR), Probability of False Detection (POFD), Success Ratio, Accuracy, Peirce's Skill Score, Critical Success Index (CSI), Gilbert Skill Score, Heidke Skill Score, Odds Ratio, Odds Ratio Skill Score, F1 score, Symmetric Extremal Dependence Index, FIxed Risk Multicategorical (FIRM) Score.
Spatial Scores that take into account spatial structure. Fractions Skill Score.
Statistical Tests Tools to conduct statistical tests and generate confidence intervals. Diebold Mariano.
Processing Tools Tools to pre-process data. Data matching, Discretisation, Cumulative Density Function Manipulation.

scores not only includes common scores (e.g. MAE, RMSE), it includes novel scores not commonly found elsewhere (e.g. FIRM, Flip-Flop Index), complex scores (e.g. threshold weighted CRPS), and statistical tests (such as the Diebold Mariano test). Additionally, it provides pre-processing tools for preparing data for scores in a variety of formats including cumulative distribution functions (CDF). scores provides its own implementations where relevant to avoid extensive dependencies.

scores primarily supports xarray datatypes for Earth system data allowing it to work with NetCDF4, HDF5, Zarr and GRIB data sources among others. scores uses Dask for scaling and performance. Some metrics work with pandas and we aim to expand this capability.

All of the scores and metrics in this package have undergone a thorough scientific review. Every score has a companion Jupyter Notebook tutorial that demonstrates its use in practice.

Contributing

To find out more about contributing, see our Contributing Guide.

All interactions in discussions, issues, emails and code (e.g. pull requests, code comments) will be managed according to the expectations outlined in the code of conduct and in accordance with all relevant laws and obligations. This project is an inclusive, respectful and open project with high standards for respectful behaviour and language. The code of conduct is the Contributor Covenant, adopted by over 40,000 open source projects. Any concerns will be dealt with fairly and respectfully, with the processes described in the code of conduct.

Using This Package

The installation guide describes four different use cases for installing, using and working with this package.

Most users currently want the all installation option. This includes the mathematical functions (scores, metrics, statistical tests etc.), the tutorial notebooks and development libraries.

From a Local Checkout of the Git Repository

> pip install -e .[all]

Here is a short example of the use of scores:

> import scores
> forecast = scores.sample_data.simple_forecast()
> observed = scores.sample_data.simple_observations()
> mean_absolute_error = scores.continuous.mae(forecast, observed)
> print(mean_absolute_error)
<xarray.DataArray ()>
array(2.)

To install the mathematical functions ONLY (no tutorial notebooks, no developer libraries), use the minimal installation option. minimal is a stable version with limited dependencies and can be installed from the Python Package Index.

> pip install scores

Finding, Downloading and Working With Data

All metrics, statistical techniques and data processing tools in scores work with xarray. Some metrics work with pandas. As such, scores works with any data source for which xarray or pandas can be used. See the Data Sources page and this tutorial for more information on finding, downloading and working with different sources of data.

Acknowledging This Work

If you use scores for a published work, we would appreciate you citing our arXiv preprint:

Leeuwenburg, T., Loveday, N., Ebert, E. E., Cook, H., Khanarmuei, M., Taggart, R. J., Ramanathan, N., Carroll, M., Chong, S., Griffiths, A., & Sharples, J. (2024). scores: A Python package for verifying and evaluating models and predictions with xarray and pandas. arXiv. https://doi.org/10.48550/arXiv.2406.07817

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

scores-0.9.2.tar.gz (89.7 kB view details)

Uploaded Source

Built Distribution

scores-0.9.2-py3-none-any.whl (100.7 kB view details)

Uploaded Python 3

File details

Details for the file scores-0.9.2.tar.gz.

File metadata

  • Download URL: scores-0.9.2.tar.gz
  • Upload date:
  • Size: 89.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for scores-0.9.2.tar.gz
Algorithm Hash digest
SHA256 f955c2a214e24bf46d5d9e146f606812179ddf01314601d962f0714e5029da5c
MD5 5b1d671ab556b68f4a7c21e41c5c5fe6
BLAKE2b-256 1aee73f0b8b6bb5afc511903529cbdaae8cab8f5673980d597e941ec61855df6

See more details on using hashes here.

File details

Details for the file scores-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: scores-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 100.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for scores-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d04234ca7eccba189673bc8c04233e97fdd6ec275f624aba64fb36fd5ad25144
MD5 f3d499b4de2a7e0d1f2fb7eb492706be
BLAKE2b-256 cc7d1d655183f70397f4678ae8cdb1e7550d6151930b937b803f5aec39a193c7

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