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

as_forecast_sample() manipulates the object if sample_id is given #972

Open
sbfnk opened this issue Nov 2, 2024 · 0 comments
Open

as_forecast_sample() manipulates the object if sample_id is given #972

sbfnk opened this issue Nov 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sbfnk
Copy link
Contributor

sbfnk commented Nov 2, 2024

Should this manipulate a copy instead? I suspect this is not behaviour people would necessarily expect.

library("scoringutils")
#> scoringutils 2.0.0 introduces major changes. We'd love your feedback!
#> <https://github.com/epiforecasts/scoringutils/issues>. To use the old version,
#> run: `remotes::install_github('epiforecasts/[email protected]')`
#> This message is displayed once per session.

set.seed(1234)

samples <- 10
value <- 5
example <- data.frame(
  observed = value,
  predicted = rnorm(samples, value, 1),
  sample = seq_len(samples)
)

scored <- suppressWarnings(
  score(as_forecast_sample(example, sample_id = "sample"))
)

colnames(example)
#> [1] "observed"  "predicted" "sample_id"

Created on 2024-11-02 with reprex v2.1.1

@seabbs seabbs added the bug Something isn't working label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants