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

metrics/probabilities: add quantile score #530

Merged
merged 22 commits into from
Aug 12, 2020

Conversation

dplarson
Copy link
Contributor

@dplarson dplarson commented Jul 18, 2020

Add Quantile Score and Quantile Skill Score for evaluating probabilistic
forecasts.

  • Closes probabilistic forecast metrics: add quantile score #520 .
  • I am familiar with the contributing guidelines.
  • Tests added.
  • Updates entries to docs/source/api.rst for API changes.
  • Adds descriptions to appropriate "what's new" file in docs/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

@dplarson dplarson marked this pull request as ready for review July 21, 2020 18:25
@wholmgren wholmgren added enhancement New feature or request metrics Issue pertains to metrics calculation labels Jul 22, 2020
@wholmgren wholmgren added this to the 1.0 rc3 milestone Jul 22, 2020
Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dplarson. Can you also make a PR to the github.io repo with the general metrics documentation?

solarforecastarbiter/metrics/probabilistic.py Outdated Show resolved Hide resolved
solarforecastarbiter/metrics/probabilistic.py Outdated Show resolved Hide resolved
solarforecastarbiter/metrics/probabilistic.py Show resolved Hide resolved
@wholmgren
Copy link
Member

Also we'll need a new rc3 whatsnew file for this (we tagged rc2 today ahead of the test trial initialization).

@dplarson
Copy link
Contributor Author

dplarson commented Jul 22, 2020

Can you also make a PR to the github.io repo with the general metrics documentation?

Sure. I'll finish revising this PR based on your comments and then open a PR to the github.io repo so that we can merge both around the same time.

@wholmgren
Copy link
Member

@dplarson #535 added a rc3 what's new file so that I could test the readthedocs integration. So you'll need to rebase/merge this PR. I'm hoping that your next push will trigger a doc build for this PR. If not try to close and reopen it.

dplarson and others added 13 commits August 4, 2020 21:51
Add Quantile Score and Quantile Skill Score for evaluating probabilistic
forecasts.
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`.
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.
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).
@dplarson
Copy link
Contributor Author

dplarson commented Aug 5, 2020

The readthedocs integration was working for a while, but now seems to have failed. To make it easier, here's what the doc pages look like for quantile score and quantile skill score (when run locally):

screenshot_doc_qs

screenshot_doc_qss

@dplarson
Copy link
Contributor Author

dplarson commented Aug 5, 2020

I think I've now covered all the necessary revisions. Also, the PR for adding the QS and QSS to the website is also ready for review: SolarArbiter/SolarArbiter.github.io#162

Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rtd logs report

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    bokeh==1.4.0 from https://files.pythonhosted.org/packages/de/70/fdd4b186d8570a737372487cc5547aac885a1270626e3ebf03db1808e4ed/bokeh-1.4.0.tar.gz#sha256=c60d38a41a777b8147ee4134e6142cea8026b5eebf48149e370c44689869dce7 (from -r requirements.txt (line 2)):
        Expected sha256 c60d38a41a777b8147ee4134e6142cea8026b5eebf48149e370c44689869dce7
             Got        8bf87f554dfc00edea05f72324772f15c7ff672a573fcf30cb055aaff89c4eab

hopefully that will magically disappear.

@dplarson
Copy link
Contributor Author

@wholmgren any other items to review or is this ready to be merged?

@wholmgren
Copy link
Member

Sorry for overlooking this @dplarson. Can you address this warning? https://github.com/SolarArbiter/solarforecastarbiter-core/pull/530/checks?check_run_id=955308462#step:6:118 Perhaps using the same approach as for the rmse skill score.

Also makes me think we should consider a more generic skill score function but let's leave that for another day.

@dplarson
Copy link
Contributor Author

Sorry for overlooking this @dplarson. Can you address this warning?

No problem. I'll address that warning and ping you when ready.

And yes, I do agree a more generic skill score function could be beneficial and is worth discussing later.

Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dplarson. Ok to merge @alorenzo175?

@alorenzo175
Copy link
Contributor

yes

@alorenzo175 alorenzo175 merged commit e8cfb4e into SolarArbiter:master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request metrics Issue pertains to metrics calculation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

probabilistic forecast metrics: add quantile score
3 participants