Skip to content

Issue #275: Fix handling of scalar inputs in logs_binary()#524

Merged
nikosbosse merged 1 commit intodevelopfrom
fix-binary-rules
Dec 11, 2023
Merged

Issue #275: Fix handling of scalar inputs in logs_binary()#524
nikosbosse merged 1 commit intodevelopfrom
fix-binary-rules

Conversation

@nikosbosse
Copy link
Copy Markdown
Collaborator

@nikosbosse nikosbosse commented Dec 6, 2023

Description

This PR closes #275.

Ideally we would like logs_binary() to be able to accept a single value as an input that then gets recycled just like any other vector in R does. The current implementation had an ifelse() statement there which did work for several observed values and a single predicted value, but not the other way round.

This PR updates the code in logs_binary() to work with scalar values and adds tests against the function ll() from the Metrics package to verify everything is correct.

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title as follows: issue-number: PR title
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • I have built the package locally and run rebuilt docs using roxygen2.
  • My code follows the established coding standards and I have run lintr::lint_package() to check for style issues introduced by my changes.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (97d204f) 81.21% compared to head (2365a22) 81.21%.

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

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

@nikosbosse nikosbosse requested a review from seabbs December 6, 2023 22:31
Copy link
Copy Markdown
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.

LGTM

@nikosbosse nikosbosse merged commit 0fb4ca2 into develop Dec 11, 2023
@nikosbosse nikosbosse deleted the fix-binary-rules branch December 11, 2023 11:01
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