Skip to content

maths\jaccard_similarity.py does not validate input and can divide by zero #6916

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

Closed
CenTdemeern1 opened this issue Oct 10, 2022 · 5 comments
Closed
Labels

Comments

@CenTdemeern1
Copy link
Contributor

Repository commit

51dba4d

Python version (python --version)

Python 3.10.2

Dependencies version (pip freeze)

pip==22.2.2
setuptools==60.10.0
wheel==0.37.1

Expected behavior

According to CONTRIBUTING.md, a ValueError should be raised in the case of erroneous input.
image

Actual behavior

This code makes no effort to check the input, and this can result in a zero division when given empty lists as input:
image

@CenTdemeern1 CenTdemeern1 changed the title maths\jaccard_similarity.py can divide by zero maths\jaccard_similarity.py does not validate input and can divide by zero Oct 10, 2022
@CoderRounak
Copy link

what do you want to return from the function when the length of union set is 0 ?
assign me i will add a validating condition

CoderRounak added a commit to CoderRounak/Python that referenced this issue Oct 10, 2022
@CenTdemeern1
Copy link
Contributor Author

Please don't beg me to assign you. I am handling this myself.
Hell, you probably didn't even read my issue message, nor did you read CONTRIBUTING.md.

@CenTdemeern1
Copy link
Contributor Author

That commit does not solve the issue!

CenTdemeern1 added a commit to CenTdemeern1/TheAlgorithms_Python that referenced this issue Oct 11, 2022
@dhruvmanila told me to commit these here so here we go
Fixes TheAlgorithms#6916 among other issues
@nfarhaan
Copy link

Hello,
Can you assign this issue to me?

@CenTdemeern1
Copy link
Contributor Author

No, go away, spambot.

@cclauss cclauss closed this as completed Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants