You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, I encountered a bug when using the average_precision metric (pytorch_lightning.metrics.functional.classification). It yields incorrect results (negative ones).
There seems to be a missing parenthesis in the code here :
import torch
import pytorch_lightning.metrics.functional.classification as M
torch.manual_seed(23)
truth = (torch.rand(100) > .6)
pred = torch.rand(100)
M.average_precision(pred, truth)
I did not find an issue on this topic yet. If needed I can submit a PR.
Thanks ☺️
The text was updated successfully, but these errors were encountered:
🐛 Bug
Hi everyone, I encountered a bug when using the average_precision metric (pytorch_lightning.metrics.functional.classification). It yields incorrect results (negative ones).
There seems to be a missing parenthesis in the code here :
https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/metrics/functional/classification.py#L847
It works when corrected as :
return -torch.sum((recall[1:] - recall[:-1]) * precision[:-1])
In order to reproduce negative results :
I did not find an issue on this topic yet. If needed I can submit a PR.
Thanks☺️
The text was updated successfully, but these errors were encountered: