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

Initialization in text #2942

Closed
opatrascoiu opened this issue Nov 18, 2018 · 2 comments · Fixed by #3004
Closed

Initialization in text #2942

opatrascoiu opened this issue Nov 18, 2018 · 2 comments · Fixed by #3004
Labels
bug Bugs and behaviour differing from documentation examples Code examples in /examples

Comments

@opatrascoiu
Copy link

In evaluate method from
https:/explosion/spacy/blob/master/examples/training/train_textcat.py
tp, fp, fn, and tn (true positives etc) are initialized to 1e-8 (see below)

tp = 1e-8  # True positives
fp = 1e-8  # False positives
fn = 1e-8  # False negative
tn = 1e-8  # True negatives

Why are the values not initlaized to 0? When there are no true positives the precision is 0.5, That doesn't seem right.

@honnibal
Copy link
Member

honnibal commented Nov 26, 2018

Fair point --- I was avoiding the divide-by-zero error, but if there are no true or false positives, I guess the precision should be 0.0. It should be more correct to initialize tp and tn to 0.0, while fp and fn are initialized to a small value to avoid the denominator being zero.

Do you want to make a pull request?

@honnibal honnibal added bug Bugs and behaviour differing from documentation examples Code examples in /examples labels Nov 26, 2018
@lock
Copy link

lock bot commented Jan 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation examples Code examples in /examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants