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

Matthews correlation coefficient should return 0 instead of NaN #779

Closed tridao closed 2 years ago

tridao commented 2 years ago

🐛 Bug

By definition, "if any of the four sums in the denominator is zero, the denominator can be arbitrarily set to one; this results in a Matthews correlation coefficient of zero, which can be shown to be the correct limiting value." However, the code does not check for this case and will return NaN.

github-actions[bot] commented 2 years ago

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