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

Faster CRPS calculations for sample distributions #240

Closed
robjhyndman opened this issue Jul 12, 2020 · 3 comments
Closed

Faster CRPS calculations for sample distributions #240

robjhyndman opened this issue Jul 12, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@robjhyndman
Copy link
Member

robjhyndman commented Jul 12, 2020

When the distribution is stored as a sample, a much faster way to compute CRPS is to use eq (3) from https://cran.r-project.org/web/packages/scoringRules/vignettes/article.pdf

@robjhyndman robjhyndman added the enhancement New feature or request label Jul 12, 2020
@mitchelloharawild
Copy link
Member

mitchelloharawild commented Jul 12, 2020

scoringRules::crps(y = 3, family = "normal", mean = 0, sd = 1)
#> [1] 2.436575
dist <- distributional::dist_normal(0, 1)
fabletools::CRPS(dist, 3)
#> [1] 2.436575
fabletools::CRPS(dist_sample(generate(dist, 10000)), 3)
#> [1] 2.43802

scoringRules::crps(y = 1, family = "unif", min = 2, max = 4.4, lmass = 0, umass = 0)
#> [1] 1.8
dist <- distributional::dist_uniform(2, 4.4)
fabletools::CRPS(dist, 1)
#> [1] 1.800799
fabletools::CRPS(dist_sample(generate(dist, 10000)), 1)
#> [1] 1.800534

Created on 2020-07-12 by the reprex package (v0.3.0)

@robjhyndman
Copy link
Member Author

robjhyndman commented Jul 12, 2020

Hmm. Must have been something else making fable go slow in my code.

@mitchelloharawild
Copy link
Member

mitchelloharawild commented Jul 12, 2020

Do you have a workflow MRE I can optimise performance for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants