Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to main for Release 1.3.0 #745

Merged
merged 40 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f3dd528
Merge pull request #685 from nci/main
tennlee Sep 13, 2024
65b2782
Remove version pinning from develop branch
tennlee Sep 13, 2024
8e36cb9
Add Zenodo archive link to Maintainers Notes (#689)
Steph-Chong Sep 13, 2024
9dbc258
Configure the documentation build to avoid three warnings during buil…
tennlee Sep 17, 2024
048d0ae
Backing out last change after reviewing readthedocs, seems not to wor…
tennlee Sep 17, 2024
3c582bb
Mark coding_practises as an orphan document to reduce by one error
tennlee Sep 17, 2024
9cdc20b
Add py func links to several binary contingency score API docstrings …
Steph-Chong Sep 17, 2024
32132ec
Add py func links to API docstrings for categorical scores (#697)
Steph-Chong Sep 17, 2024
0e0cac0
Add py func links to Peirce's skill score, true skill statistic and H…
Steph-Chong Sep 17, 2024
7e40d9b
Minor update to maintainers notes section about .zenodo.json (#699)
Steph-Chong Sep 17, 2024
8ff29ee
Added interval twCRPS for ensembles (#682)
nicholasloveday Sep 18, 2024
05bc6f9
Add KGE Score (#700)
tennlee Oct 7, 2024
9504cb7
crps ensembles is faster and more robust (#694)
nicholasloveday Oct 16, 2024
5fe09ab
support for python 3.13. Drop support for Python 3.9 (#710)
nicholasloveday Oct 18, 2024
84cd493
Add quantile interval score (#704)
reza-armuei Oct 18, 2024
fbcc8fe
tw crps tutorial
nicholasloveday Oct 23, 2024
8f8f0cc
crps decomposition (#708)
nicholasloveday Oct 24, 2024
8eabd16
Update incorrect DOI
tennlee Oct 28, 2024
4d73670
721 update twcrps tutorial (#722)
nicholasloveday Nov 1, 2024
535e7c9
Update table in README to include Percent Bias and KGE (#728)
Steph-Chong Nov 2, 2024
9c69ae6
update pr template
nicholasloveday Nov 3, 2024
6d053dd
Update pre-commit workflow to latest versions of runners
tennlee Nov 3, 2024
cc5f766
Updates to crps_cdf docstring (#730)
tennlee Nov 3, 2024
82acadb
Adjust how CRPS for ensemble methods are grouped in included.md (#732)
tennlee Nov 3, 2024
fe64e40
Updated docs for quantile_interval_score
reza-armuei Nov 5, 2024
1485879
729 crps ens and kge now use include components (#734)
nicholasloveday Nov 5, 2024
9ce7bc8
Updated tutorial notebook for interval score (#736)
reza-armuei Nov 13, 2024
0e3889f
Rename notebook filename to match the title of the notebook
tennlee Nov 13, 2024
ce9d280
Update to grammar regarding forecast conditions being uncertain
tennlee Nov 13, 2024
22c8dd7
Add newline to improve rendering in readthedocs
tennlee Nov 13, 2024
9f94c47
Minor grammatical fix to api docstring
tennlee Nov 13, 2024
dbac6e2
Update pre-commit stage names in line with deprecation warning
tennlee Nov 13, 2024
866a2f1
Correction to underforecast penalty term in mathjax (#738)
tennlee Nov 14, 2024
5ca8b7f
Update thumbnail description for categorical scores tutorial (#741)
Steph-Chong Nov 14, 2024
9981b1b
Bring release notes up to date (#726)
Steph-Chong Nov 14, 2024
acfc90f
Update release notes regarding Python version support
tennlee Nov 14, 2024
089be8b
Add tutorial links to categorical API docstrings (#742)
Steph-Chong Nov 14, 2024
7a0d42b
Update first level header in binary categorical scores tutorial (#743)
Steph-Chong Nov 14, 2024
0fb4d38
Minor tweak to release notes (#744)
Steph-Chong Nov 15, 2024
d969ae8
Merge branch 'main' into develop
tennlee Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ Please work through the following checklists. Delete anything that isn't relevan
## Development for new xarray-based metrics
- [ ] Works with n-dimensional data and includes `reduce_dims`, `preserve_dims`, and `weights` args.
- [ ] Typehints added
- [ ] Docstrings complete and followed Napoleon (google) style
- [ ] Reference to paper/webpage is in docstring
- [ ] Add error handling
- [ ] Imported into the API
- [ ] Works with both `xr.DataArrays` and `xr.Datasets` if possible

## Docstrings
- [ ] Docstrings complete and follow Napoleon (google) style
- [ ] Maths equation added
- [ ] Reference to paper/webpage is in docstring. The preferred referencing style for journal articles is [APA (7th edition)](https://apastyle.apa.org/style-grammar-guidelines/references/examples/journal-article-references)
- [ ] Code example added


## Testing of new xarray-based metrics
- [ ] 100% unit test coverage
Expand All @@ -14,7 +20,7 @@ Please work through the following checklists. Delete anything that isn't relevan
- [ ] Test that broadcasting with xarray works
- [ ] Test both reduce and preserve dims arguments work
- [ ] Test that errors are raised as expected
- [ ] Test that it works with both `xr.Dataarrays` and `xr.Datasets`
- [ ] Test that it works with both `xr.DataArrays` and `xr.Datasets`

## Tutorial notebook
- [ ] Short introduction to why you would use that metric and what it tells you
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
*.DS_Store

# Installer logs
pip-log.txt
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ repos:
name: pytest
entry: pytest tests/ --cov=src/scores --cov-report term-missing
language: system
stages: [push]
stages: [pre-push]
always_run: true
pass_filenames: false
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Below is a **curated selection** of the metrics, tools and statistical tests inc

| | **Description** | **Selection of Included Functions** |
|----------------------- |----------------- |-------------- |
| **[Continuous](https://scores.readthedocs.io/en/stable/included.html#continuous)** |Scores for evaluating single-valued continuous forecasts. |MAE, MSE, RMSE, Additive Bias, Multiplicative Bias, Pearson's Correlation Coefficient, Flip-Flop Index, Quantile Loss, Murphy Score, and threshold weighted scores for expectiles, quantiles and Huber Loss. |
| **[Continuous](https://scores.readthedocs.io/en/stable/included.html#continuous)** |Scores for evaluating single-valued continuous forecasts. |MAE, MSE, RMSE, Additive Bias, Multiplicative Bias, Percent Bias, Pearson's Correlation Coefficient, Kling-Gupta Efficiency, Flip-Flop Index, Quantile Loss, Quantile Interval Score, Interval Score, Murphy Score, and threshold weighted scores for expectiles, quantiles and Huber Loss. |
| **[Probability](https://scores.readthedocs.io/en/stable/included.html#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 Functions (CDF) and ensembles (including threshold weighted versions), Receiver Operating Characteristic (ROC), Isotonic Regression (reliability diagrams). |
| **[Categorical](https://scores.readthedocs.io/en/stable/included.html#categorical)** |Scores for evaluating forecasts of categories. |17 binary contingency table (confusion matrix) metrics and the FIxed Risk Multicategorical (FIRM) Score. |
| **[Spatial](https://scores.readthedocs.io/en/stable/included.html#spatial)** |Scores that take into account spatial structure. |Fractions Skill Score. |
| **[Statistical Tests](https://scores.readthedocs.io/en/stable/included.html#statistical-tests)** |Tools to conduct statistical tests and generate confidence intervals. |Diebold Mariano. |
| **[Processing Tools](https://scores.readthedocs.io/en/stable/included.html#processing-tools-for-preparing-data)** |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 (e.g., 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` not only includes common scores (e.g., MAE, RMSE), it also includes novel scores not commonly found elsewhere (e.g., FIRM, Flip-Flop Index), complex scores (e.g., threshold weighted CRPS), and statistical tests (e.g., 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 formats among others. `scores` uses Dask for scaling and performance. Some metrics work with pandas and we aim to expand this capability.

Expand Down
4 changes: 4 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.. autofunction:: scores.continuous.correlation.pearsonr
.. autofunction:: scores.continuous.multiplicative_bias
.. autofunction:: scores.continuous.pbias
.. autofunction:: scores.continuous.kge
.. autofunction:: scores.continuous.isotonic_fit
.. autofunction:: scores.continuous.consistent_expectile_score
.. autofunction:: scores.continuous.consistent_quantile_score
Expand All @@ -32,6 +33,8 @@
.. autofunction:: scores.continuous.tw_squared_error
.. autofunction:: scores.continuous.tw_huber_loss
.. autofunction:: scores.continuous.tw_expectile_score
.. autofunction:: scores.continuous.quantile_interval_score
.. autofunction:: scores.continuous.interval_score
```

## scores.probability
Expand All @@ -43,6 +46,7 @@
.. autofunction:: scores.probability.crps_for_ensemble
.. autofunction:: scores.probability.tw_crps_for_ensemble
.. autofunction:: scores.probability.tail_tw_crps_for_ensemble
.. autofunction:: scores.probability.interval_tw_crps_for_ensemble
.. autofunction:: scores.probability.murphy_score
.. autofunction:: scores.probability.murphy_thetas
.. autofunction:: scores.probability.roc_curve_data
Expand Down
4 changes: 4 additions & 0 deletions docs/coding_practices.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```{eval-rst}
:orphan:
```

# Coding Practices

The [Contributing Guide](contributing.md) provides (among other things) guidance on the workflows and general expectations associated with contributing a code change to `scores`. This document eschews some of the context to focus on specifying technical information needed when developing code for `scores`.
Expand Down
42 changes: 33 additions & 9 deletions docs/included.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,22 @@
[Tutorial](project:./tutorials/Flip_Flop_Index.md)
-
[Griffiths et al. (2019)](https://doi.org/10.1002/met.1732); [Griffiths et al. (2021)](https://doi.org/10.1071/ES21010)
* - Interval Score
- [API](api.md#scores.continuous.interval_score)
- [Tutorial](project:./tutorials/Quantile_Interval_And_Interval_Scores.md)
- [Gneiting and Raftery (2007) - Section 6.2](https://doi.org/10.1198/016214506000001437)
* - Isotonic Fit, *see Isotonic Regression*
- —
- —
- —
* - Isotonic Regression (Isotonic Fit, Reliability Diagram)
- [API](api.md#scores.continuous.isotonic_fit)
- [Tutorial](project:./tutorials/Isotonic_Regression_And_Reliability_Diagrams.md)
- [de Leeuw et al. (2009)](https://doi.org/10.18637/jss.v032.i05); [Dimitriadis et al. (2020)](https://doi.org/10.1073/pnas.2016191118); [Jordan et al. (2020), version 2](https://doi.org/10.48550/arXiv.1904.04761)
- [de Leeuw et al. (2009)](https://doi.org/10.18637/jss.v032.i05); [Dimitriadis et al. (2020)](https://doi.org/10.1073/pnas.2016191118); [Jordan et al. (2020), version 2](https://doi.org/10.48550/arXiv.1904.04761)
* - Kling–Gupta Efficiency (KGE)
- [API](api.md#scores.continuous.kge)
- [Tutorial](project:./tutorials/Kling_Gupta_Efficiency.md)
- [Gupta et al. (2009)](https://doi.org/10.1016/j.jhydrol.2009.08.003); [Knoben et al. (2019)](https://doi.org/10.5194/hess-23-4323-2019)
* - Mean Absolute Error (MAE)
- [API](api.md#scores.continuous.mae)
- [Tutorial](project:./tutorials/Mean_Absolute_Error.md)
Expand Down Expand Up @@ -105,6 +113,10 @@
- —
- —
- —
* - Quantile Interval Score
- [API](api.md#scores.continuous.quantile_interval_score)
- [Tutorial](project:./tutorials/Quantile_Interval_And_Interval_Scores.md)
- [Winkler (1972) ](https://doi.org/10.2307/2284720)
* - Quantile Loss (Quantile Score, Pinball Loss)
- [API](api.md#scores.continuous.quantile_score)
- [Tutorial](project:./tutorials/Quantile_Loss.md)
Expand Down Expand Up @@ -181,9 +193,29 @@
- —
- —
* - Continuous Ranked Probability Score (CRPS) for Ensembles
-
-
-
* -
- CRPS for Ensembles
- [API](api.md#scores.probability.crps_for_ensemble)
- [Tutorial](project:./tutorials/CRPS_for_Ensembles.md)
- [Ferro (2014)](https://doi.org/10.1002/qj.2270); [Gneiting And Raftery (2007)](https://doi.org/10.1198/016214506000001437); [Zamo and Naveau (2018)](https://doi.org/10.1007/s11004-017-9709-7)
* -
- Threshold-Weighted CRPS (twCRPS) for Ensembles
- [API](api.md#scores.probability.tw_crps_for_ensemble)
- [Tutorial](project:./tutorials/Threshold_Weighted_CRPS_for_Ensembles.md)
- [Allen et al. (2023)](https://doi.org/10.1137/22M1532184); [Allen (2024)](https://doi.org/10.18637/jss.v110.i08)
* -
- Interval-Threshold-Weighted CRPS (twCRPS) for Ensembles
- [API](api.md#scores.probability.interval_tw_crps_for_ensemble)
- [Tutorial](project:./tutorials/Threshold_Weighted_CRPS_for_Ensembles.md)
- [Allen et al. (2023)](https://doi.org/10.1137/22M1532184); [Allen (2024)](https://doi.org/10.18637/jss.v110.i08)
* -
- Tail-Threshold-Weighted CRPS (twCRPS) for Ensembles
- [API](api.md#scores.probability.tail_tw_crps_for_ensemble)
- [Tutorial](project:./tutorials/Threshold_Weighted_CRPS_for_Ensembles.md)
- [Allen et al. (2023)](https://doi.org/10.1137/22M1532184); [Allen (2024)](https://doi.org/10.18637/jss.v110.i08)
* - Isotonic Fit, *see Isotonic Regression*
- —
- —
Expand Down Expand Up @@ -224,14 +256,6 @@
- —
- —
- —
* - Tail Threshold Weighted Continuous Ranked Probability Score (twCRPS) for Ensembles
- [API](api.md#scores.probability.tail_tw_crps_for_ensemble)
- —
- [Allen et al. (2023)](https://doi.org/10.1137/22M1532184)
* - Threshold Weighted Continuous Ranked Probability Score (twCRPS) for Ensembles
- [API](api.md#scores.probability.tw_crps_for_ensemble)
- —
- [Allen et al. (2023)](https://doi.org/10.1137/22M1532184)
```

## Categorical
Expand Down
3 changes: 2 additions & 1 deletion docs/maintainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Information relevant for package maintenance

### Confirm Zenodo correctness

Link to Zenodo archive: [https://doi.org/10.5281/zenodo.12697241](https://doi.org/10.5281/zenodo.12697241)
1. Confirm license
2. Confirm authors
3. Scan everything else
Expand Down Expand Up @@ -93,7 +94,7 @@ If so, please open a new pull request. In that pull request please add your deta
In .zenodo.json, please add your details at the bottom of the “creators” section. The fields you will need to complete are:

1. “orcid”. This is an optional field. If you don’t have an ORCID, but would like one, you can obtain one here: https://info.orcid.org/researchers/ .
2. “affiliation”. Options include: the name of the institution you are affiliated with, “Independent Researcher” or “Independent Contributor”.
2. “affiliation”. Options include: the institution you are affiliated with, “Independent Researcher” or “Independent Contributor”.
3. “name”. Format: surname, given name(s).
```

Expand Down
39 changes: 39 additions & 0 deletions docs/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Release Notes (What's New)

## Version 1.3.0 (November 15, 2024)

For a list of all changes in this release, see the [full changelog](https://github.com/nci/scores/compare/1.2.0...1.3.0). Below are the changes we think users may wish to be aware of.

### Introduced Support for Python 3.13 and Dropped Support for Python 3.9

- In line with other scientific Python packages, `scores` has dropped support for Python 3.9 in this release.
`scores` has added support for Python 3.13. See [PR #710](https://github.com/nci/scores/pull/710).

### Features

- Added four new metrics:
- Quantile Interval Score: `scores.continuous.quantile_interval_score`. See [PR #704](https://github.com/nci/scores/pull/704), [PR #733](https://github.com/nci/scores/pull/733) and [PR #738](https://github.com/nci/scores/pull/738).
- Interval Score: `scores.continuous.interval_score`. See [PR #704](https://github.com/nci/scores/pull/704), [PR #733](https://github.com/nci/scores/pull/733) and [PR #738](https://github.com/nci/scores/pull/738).
- Kling-Gupta Efficiency (KGE): `scores.continuous.kge`. See [PR #679](https://github.com/nci/scores/pull/679), [PR #700](https://github.com/nci/scores/pull/700) and [PR #734](https://github.com/nci/scores/pull/734).
- Interval threshold weighted continuous ranked probability score (twCRPS) for ensembles: `scores.probability.interval_tw_crps_for_ensemble`. See [PR #682](https://github.com/nci/scores/pull/682) and [PR #734](https://github.com/nci/scores/pull/734).
- Added an optional `include_components` argument to several continuous ranked probability score (CRPS) functions for ensembles. If supplied, the `include_components` argument will return the underforecast penalty, the overforecast penalty and the forecast spread term, in addition to the overall CRPS value. This applies to the following CRPS functions:
- continuous ranked probability score (CRPS) for ensembles: `scores.probability.crps_for_ensemble`
- threshold weighted continuous ranked probability score (twCRPS) for ensembles: `scores.probability.tw_crps_for_ensemble`
- tail threshold weighted continuous ranked probability score (twCRPS) for ensembles: `scores.probability.tail_tw_crps_for_ensemble`
- interval threshold weighted continuous ranked probability score (twCRPS) for ensembles: `scores.probability.interval_tw_crps_for_ensemble`)
See [PR #708](https://github.com/nci/scores/pull/708) and [PR #734](https://github.com/nci/scores/pull/734).

### Documentation

- Added "Kling–Gupta Efficiency (KGE)" tutorial. See [PR #679](https://github.com/nci/scores/pull/679), [PR #700](https://github.com/nci/scores/pull/700) and [PR #734](https://github.com/nci/scores/pull/734).
- Added "Quantile Interval Score and Interval Score" tutorial. See [PR #704](https://github.com/nci/scores/pull/704), [PR #736](https://github.com/nci/scores/pull/736) and [PR #738](https://github.com/nci/scores/pull/738).
- Added "Threshold Weighted Continuous Ranked Probability Score (twCRPS) for ensembles" tutorial. See [PR #706](https://github.com/nci/scores/pull/706) and [PR #722](https://github.com/nci/scores/pull/722).
- Updated the title in the "Binary Categorical Scores and Binary Contingency Tables (Confusion Matrices)" tutorial and the description for the corresponding thumbnail in the tutorial gallery. See [PR #741](https://github.com/nci/scores/pull/741) and [PR #743](https://github.com/nci/scores/pull/743).
- Updated the pull request template. See [PR #719](https://github.com/nci/scores/pull/719).

### Internal Changes

- Sped up (improved the computational efficiency of) the continuous ranked probability score (CRPS) for ensembles. This also addresses memory issues when a large number of ensemble members are present. See [PR #694](https://github.com/nci/scores/pull/694).

### Contributors to this Release

Mohammadreza Khanarmuei ([@reza-armuei](https://github.com/reza-armuei)), Nicholas Loveday ([@nicholasloveday](https://github.com/nicholasloveday)), Durga Shrestha ([@durgals](https://github.com/durgals)), Tennessee Leeuwenburg ([@tennlee](https://github.com/tennlee)), Stephanie Chong ([@Steph-Chong](https://github.com/Steph-Chong)) and Robert J. Taggart ([@rob-taggart](https://github.com/rob-taggart)).

## Version 1.2.0 (September 13, 2024)

For a list of all changes in this release, see the [full changelog](https://github.com/nci/scores/compare/1.1.0...1.2.0). Below are the changes we think users may wish to be aware of.
Expand Down
16 changes: 9 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Scores is a package containing mathematical functions \
for the verification, evaluation and optimisation of forecasts, predictions or models.
"""
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
dependencies = [
"xarray ~= 2024.1",
"pandas ~= 2.0",
"scipy ~= 1.1",
"bottleneck ~= 1.3",
"scikit-learn ~= 1.4",
"xarray",
"pandas",
"scipy",
"bottleneck",
"scikit-learn",
]

[project.optional-dependencies]
Expand All @@ -49,7 +49,9 @@ tutorial = [
"rasterio",
"rioxarray",
"plotly",
"dask"
"dask",
"gcsfs",
"zarr"
]
maintainer = ["build",
"hatch",
Expand Down
Loading