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

Update input formats for binary and point forecasts #460

Merged
merged 6 commits into from
Nov 20, 2023

Conversation

nikosbosse
Copy link
Contributor

@nikosbosse nikosbosse commented Nov 17, 2023

Closes #424, where we discussed that binary and point forecasts so far didn't allow the following inputs:

  • a scalar to be recycled
  • a matrix with 1 column

The first one is very standard behaviour in R so it would be nice to support it and the second one makes the function more consistent with the input formats of e.g. quantile- and sample-based functions, which all expect predicted to be a matrix.

This PR therefore updates the input checks for binary and point forecasts to allow these. It also expands tests to test the new input requirements.

To simplify code, it also creates a new helper function, check_dims_ok_point() and assert_dims_ok_point that checks the dimensions for binary and point forecasts. (In the future we could also do something like that for quantile and sample-based forecasts, I added it to a new issue, #459.

I added tests for the point inputs to the binary tests. My reasoning was that tests for binary and point inputs should always be very similar. Having them in one place makes it easier to not forget a test for point that we have for binary and vice versa. And I thought it would be a bit cleaner to have corresponding tests together. The test file for point metrics currently mostly has a few legacy tests from covidHubUtils. I couldn't bring myself to embark on a grand test clean-up right now, but I at least noted it in #346.

Note:
There's a small unrelated change mixed in this PR: see #468. The change was just removing old code remnants that weren't updated due to the same code being changed by 2 PRs:

  • I had remove a function from correlation(), check_metric(), that should not exist anymore after all the updates.
  • had to rename scores to scores_quantile in a failing test that got updated on dev previously, but not in all the branches we merged.

The change is in this PR, but also in #468. I think merging #468 first would be a bit cleaner (I decided midway to try and do things properly by making a separate PR to untangle the fix from the new feature...).

@nikosbosse nikosbosse requested a review from seabbs November 17, 2023 09:03
@nikosbosse nikosbosse changed the base branch from dev-backup to dev November 18, 2023 15:38
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.

The change is in this PR, but also in #468. I think merging #468 first would be a bit cleaner (I decided midway to try and do things properly by making a separate PR to untangle the fix from the new feature...).

Nothing is stopping you from closing PRs and sorting this out and then reupdating them or even just updating the PR with a note. As a reviewer with limited time this is really quite frustrating practice.

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.

Looks fine. Usual few linting issues which can resolve or not as you wish.

R/check-inputs-scoring-functions.R Outdated Show resolved Hide resolved
R/check-inputs-scoring-functions.R Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (develop@4df4576). Click here to learn what that means.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #460   +/-   ##
==========================================
  Coverage           ?   81.21%           
==========================================
  Files              ?       20           
  Lines              ?     1725           
  Branches           ?        0           
==========================================
  Hits               ?     1401           
  Misses             ?      324           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nikosbosse nikosbosse merged commit b778f8a into develop Nov 20, 2023
10 of 11 checks passed
@nikosbosse nikosbosse deleted the update-binary-input branch November 20, 2023 12:22
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.

2 participants