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

Add check function #154

Merged
merged 21 commits into from
Nov 25, 2021
Merged

Add check function #154

merged 21 commits into from
Nov 25, 2021

Conversation

nikosbosse
Copy link
Contributor

Adds a function to check the input for eval_forecasts().
Returns a list with different checks

@nikosbosse
Copy link
Contributor Author

sorry, mixed this up with a few other tweaks. Relevant file is check_forecasts.R

@codecov
Copy link

codecov bot commented Nov 23, 2021

Codecov Report

Merging #154 (1009e7b) into master (29ac025) will increase coverage by 6.12%.
The diff coverage is 60.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #154      +/-   ##
==========================================
+ Coverage   48.44%   54.56%   +6.12%     
==========================================
  Files          18       19       +1     
  Lines        1348     1468     +120     
==========================================
+ Hits          653      801     +148     
+ Misses        695      667      -28     
Impacted Files Coverage Δ
R/eval_forecasts.R 67.27% <ø> (+1.20%) ⬆️
R/pairwise-comparisons.R 42.36% <ø> (ø)
R/plot.R 20.29% <ø> (+20.29%) ⬆️
R/utils.R 71.42% <ø> (+7.93%) ⬆️
R/utils_data_handling.R 79.24% <ø> (+6.60%) ⬆️
R/check_forecasts.R 57.14% <57.14%> (ø)
R/eval_forecasts_quantile.R 93.75% <100.00%> (-0.31%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29ac025...1009e7b. Read the comment docs.

@nikosbosse
Copy link
Contributor Author

tests still missing at the moment (although examples are run).

@nikosbosse nikosbosse mentioned this pull request Nov 23, 2021
Copy link
Member

@Bisaloo Bisaloo left a comment

Choose a reason for hiding this comment

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

There are some inconsistency in using = vs <- so it might be worth running styler.

R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
tests/testthat/test-check_forecasts.R Outdated Show resolved Hide resolved
nikosbosse and others added 2 commits November 24, 2021 21:59
Co-authored-by: Hugo Gruson <Bisaloo@users.noreply.github.com>
Co-authored-by: Hugo Gruson <Bisaloo@users.noreply.github.com>
R/check_forecasts.R Outdated Show resolved Hide resolved
R/check_forecasts.R Outdated Show resolved Hide resolved
Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

This looks good Nikos. Mostly just need to resolve @Bisaloo points.

One comment: If the end goal is to have eval_forecasts be a S3 method itself then at some point the input needs to be assigned a scoringutils class to make that happen. One way you could do this is to assign a class here for each data type as well as your check type and then return the data and checks in a list.

This as a workflow would then be something like this:

data |> 
   check_forecasts() |>
   eval_forecasts() 

or 

checked_data <- check_forecasts(data)
print(checked_data)
eval_forecasts(checked_data)

Co-authored-by: Hugo Gruson <Bisaloo@users.noreply.github.com>
@nikosbosse
Copy link
Contributor Author

My idea re S3 classes would be this:

  • first we add the check function without changing the workflow
  • then we do a workflow change (if we agree we want that) together with all the other breaking changes that will come soon.

At the moment you can run check_forecasts() independently and I think for now that's good and definitely better than not having it. I was a bit on the fence whether it should also return the data with all the NA values removed (that's essentially the only thing it does to alter the data).

@nikosbosse
Copy link
Contributor Author

Thank you very much for your help and review @Bisaloo, @seabbs 🎉 !

@nikosbosse nikosbosse merged commit 57c0773 into master Nov 25, 2021
@nikosbosse nikosbosse deleted the add-check-function branch November 25, 2021 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants