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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-change An actual code change. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants