Lightning-AI / torchmetrics

Machine learning metrics for distributed, scalable PyTorch applications.
https://lightning.ai/docs/torchmetrics/
Apache License 2.0
2.14k stars 408 forks source link

Bug in Matthews_correlation_coefficient #320

Closed del2z closed 3 years ago

del2z commented 3 years ago

I've tested the ConfusionMatrix and got results similar to the one in https://en.wikipedia.org/wiki/Matthews_correlation_coefficient. However, the code in line 23 is incorrect according to the confusion matrix. tk, defined as the number of times class k truly occurred, should be the summation along axis=1; pk, on the other hand, is the summation of confusion matrix along axis=0. Although this mistake does not affect the final result of Matthews correlation coefficient, it may lead to some misunderstanding of the confusion matrix. Hope it can be fixed.

github-actions[bot] commented 3 years ago

Hi! thanks for your contribution!, great first issue!

SkafteNicki commented 3 years ago

@del2z Thanks for bringing this to our attention. I created PR #321 to fix this.