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

Move checking in r2 for number of samples to compute #426

Merged
merged 4 commits into from
Aug 4, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Aug 4, 2021

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes #423
R2 score can only be calculated when having two samples. We check for this, but the check should first happen in the _compute method instead of the _update method. This PR moves the check.

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Aug 4, 2021
@SkafteNicki SkafteNicki added this to the v0.5 milestone Aug 4, 2021
@codecov
Copy link

codecov bot commented Aug 4, 2021

Codecov Report

Merging #426 (9e40f98) into master (ad9845b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #426   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files         126      126           
  Lines        4088     4088           
=======================================
  Hits         3928     3928           
  Misses        160      160           
Flag Coverage Δ
Linux 74.68% <50.00%> (ø)
Windows 74.68% <50.00%> (ø)
cpu 96.01% <100.00%> (ø)
gpu 96.01% <100.00%> (ø)
macOS 96.01% <100.00%> (ø)
pytest 96.08% <100.00%> (ø)
python3.6 95.25% <100.00%> (ø)
python3.8 96.01% <100.00%> (ø)
python3.9 95.91% <100.00%> (ø)
torch1.3.1 95.25% <100.00%> (ø)
torch1.4.0 95.32% <100.00%> (ø)
torch1.9.0 95.91% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
torchmetrics/functional/regression/r2.py 95.12% <100.00%> (ø)

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 ad9845b...9e40f98. Read the comment docs.

@SkafteNicki SkafteNicki enabled auto-merge (squash) August 4, 2021 08:06
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@SkafteNicki SkafteNicki merged commit b487ac3 into master Aug 4, 2021
@SkafteNicki SkafteNicki deleted the r2_move_error branch August 4, 2021 09:26
@Borda Borda added this to the v0.5 milestone Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

R2Score errors on size 1 batch updates
3 participants