-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metrics/probabilities: add quantile score (#530)
* metrics/probabilities: add quantile score Add Quantile Score and Quantile Skill Score for evaluating probabilistic forecasts. * metrics/probabilistic: update _MAP variables * metrics/probabilistic: add quantile_score test * metrics/tests: add more quantile score test cases * metrics/tests: add quantile skill score test * quantile_score: revise to use indicator func form Revise the quantile_score() function use the indicator function form, which, while not as intuitive as explicitly listing out the if-else calculation, is more robust to handling either a single `obs, fx, fx_prob` input or an array of `obs, fx, fx_prob` inputs. But to counteract the non-intuitive nature of the indicator function form, this commit also adds notes in the function docstring to explain how the function behaves for when `obs > fx` and `obs < fx`. * docs/api: add quantile score and skill score * tests/calculator: fix test that relied on ordering of results Fix a test that relied on checking the ordering of the probabilistic metric results since the addition of the quantile score and skill score bumped the indexing. * probabilistic: remove extra `-` from docstring * docstring: correct unit in examples * docs/whatsnew: add quantile score API change * improve docstring and add references * use :math:`x` in quantile skill score docstring * docstring: add line breaks in multi-line equation * docstring: try align and eqnarray for multi-line eqn * get equations rendering properly (maybe...) * quantile skill score: improve math formatting * flake8: ignore E501 and W605 in QS docstring Ignore E501 (line too long) in QS docstring since the specific line is an equation and breaking it up over multiple lines doesn't seem worth it. Ignore W605 (invalid escape sequence '\{' and '\}') in QS docstring since those are necessary strings for the LaTeX equations (i.e. without the escape character, the curly brackets will not be rendered in the readthedocs output). * Add additional tests for quantile skill score Add additional tests, including for edge cases such as negative infinity. * add Wilks 3rd edition reference * cite Bouallegue et al. (2015) for quantile skill score * quantile_skill_score: explicitly handle divide by zero warnings
- Loading branch information
Showing
5 changed files
with
177 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters