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

Fixed error message when raising to negative exponent #3232 #3259

Closed
wants to merge 2 commits into from
Closed

Fixed error message when raising to negative exponent #3232 #3259

wants to merge 2 commits into from

Conversation

tchan102
Copy link

Fixed #3232
In gensim/models/word2vec.py, we changed the line , we type-casted ns_exponent in def make_cum_table(self, domain=2**31 - 1) to a float to allow raising integers to negative exponent.

@piskvorky
Copy link
Owner

Duplicate of #3250.

@piskvorky piskvorky closed this Oct 27, 2021
@lelandbatey
Copy link

Suggested edits #1; improve the description of the PR.

Fixes #3232
Fixed the bug where a using a negative integer exponent within a Doc2Vec model causes the "ValueError: Integers to negative integer powers are not allowed." to be raised. Fixed by always casting the exponent to a float.

@@ -43,7 +43,7 @@ Features

If this feature list left you scratching your head, you can first read
more about the [Vector Space Model] and [unsupervised document analysis]
on Wikipedia.
on Wikipedia.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future I'd suggest leaving out, or removing at the end, unnecessary whitespace changes in documentation.

@@ -0,0 +1,8416 @@
/* Generated by Cython 0.29.23 */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems like it's an auto-generated file which isn't related to this PR. If it is unrelated, then this file should be removed. If this file is related and required for this PR, then the reasons why should be explained in the description of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Negative exponent with value -1 (minus one) raises error when loading Doc2Vec model
3 participants