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

Fix code to correspond to equation for matthews_corrcoef #321

Merged
merged 3 commits into from
Jun 28, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Jun 26, 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 #320
Currently there is a small mismatch between the definition of matthews corrcoef and our code. The code was still correct because the equation is symmetrical, but as requested by an user our code should match the definition. PR fixes this.

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 Jun 26, 2021
CHANGELOG.md Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 26, 2021

Codecov Report

Merging #321 (a0e3847) into master (aa554ac) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
+ Coverage   96.58%   96.64%   +0.05%     
==========================================
  Files         107      107              
  Lines        3428     3428              
==========================================
+ Hits         3311     3313       +2     
+ Misses        117      115       -2     
Flag Coverage Δ
Linux 75.83% <100.00%> (ø)
Windows 75.83% <100.00%> (ø)
cpu 96.58% <100.00%> (ø)
gpu 96.55% <100.00%> (?)
macOS 96.58% <100.00%> (ø)
pytest 96.64% <100.00%> (+0.05%) ⬆️
python3.6 95.67% <100.00%> (ø)
python3.8 96.58% <100.00%> (ø)
python3.9 96.49% <100.00%> (ø)
torch1.3.1 95.67% <100.00%> (ø)
torch1.4.0 95.77% <100.00%> (ø)
torch1.9.0 96.49% <100.00%> (ø)

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

Impacted Files Coverage Δ
...ics/functional/classification/matthews_corrcoef.py 100.00% <100.00%> (ø)
torchmetrics/functional/regression/spearman.py 97.77% <0.00%> (+4.44%) ⬆️

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 aa554ac...a0e3847. Read the comment docs.

@Borda
Copy link
Member

Borda commented Jun 28, 2021

@SkafteNicki shall we add some text covering this case as you made a change but no effect on tested cases...

@SkafteNicki
Copy link
Member Author

@Borda the change does not matter for the correctness of the result because both quantities are just multiplied together in the end. However, the user that raised the issue found it confusing that the two quantities where switched around (compared to the formula on Wikipedia) and therefore wanted it changed.

@SkafteNicki SkafteNicki enabled auto-merge (squash) June 28, 2021 08:54
@SkafteNicki SkafteNicki merged commit 4fc3a7a into master Jun 28, 2021
@SkafteNicki SkafteNicki deleted the matthews_formula_fix branch June 28, 2021 09:27
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.

Bug in Matthews_correlation_coefficient
3 participants