Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Avoid division by zero in TPR (and similar metrics) #423

Open
tmke8 opened this issue Mar 13, 2021 · 3 comments
Open

Avoid division by zero in TPR (and similar metrics) #423

tmke8 opened this issue Mar 13, 2021 · 3 comments
Labels
code-change An actual code change. enhancement New feature or request
Milestone

Comments

@tmke8
Copy link
Member

tmke8 commented Mar 13, 2021

TPR is defined like this:

return t_pos / (t_pos + f_neg)

If both t_pos and f_neg are 0, then numpy produces NaN. But I'd argue that the result should be 0 instead.

cc @olliethomas @MylesBartlett

@tmke8 tmke8 added the enhancement New feature or request label Mar 13, 2021
@tmke8 tmke8 changed the title Avoid division by zero on TPR (and similar metrics) Avoid division by zero in TPR (and similar metrics) Mar 13, 2021
@olliethomas
Copy link
Member

I know we've spoken about this before.

Conversation from 24th November 2020

oliver 15:40
maybe 0/0 should be 0 :man-shrugging:
thomas_k 15:40
I think it’s more informative to report this as nan

and I know we'd discussed it before then too.... Maybe. we should just make it 0

@tmke8
Copy link
Member Author

tmke8 commented Mar 13, 2021

hm, I see... maybe my past self was right.

@tmke8
Copy link
Member Author

tmke8 commented May 30, 2022

I think we should still avoid the division by zero because it produces annoying warnings. We can still return NaN though.

@tmke8 tmke8 added the code-change An actual code change. label May 30, 2022
@tmke8 tmke8 added this to the EthicML 2.0 milestone May 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
code-change An actual code change. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants