-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Word2vec n_similarity returning numpy matrix instead of float with empty list #743
Comments
Yes, good catch. This is numpy trying to be clever and issuing a warning, instead of a normal exception for division by zero. I agree that this is unintuitive, and we should detect this and raise an exception ourselves. Is |
@smagnan Ping - is it ok if we implement |
Sorry for the delay to reply, I planned to do a patch at first but then forgot about it... Yes I guess a |
Fixes Issue piskvorky#743, n_similarity method now raises ZeroDivisionError if atleast one empty list is passed to it.
Added new test cases in testSimilarities method which makes sure whether ZeroDivisionError is raised if atleast one empty list is passed to word2vec.n_similarities method Related to fix for issue piskvorky#743
Fixed in #883 |
I don't know if this should be seen as a bug or not, but it the case where we give at least an empty list to
n_similarity
is not handled. (The result is not surprising tho)I would have expected that to raise an exception but maybe it is not what was intended ...
Source code is rather simple:
The text was updated successfully, but these errors were encountered: