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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ community.
Features
--------

- All algorithms are **memory-independent** w.r.t. the corpus size
- All algorithms are **memory-independent** w.r.t. the corpus size
(can process input larger than RAM, streamed, out-of-core),
- **Intuitive interfaces**
- easy to plug in your own input corpus/datastream (trivial
Expand All @@ -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.


Installation
------------
Expand Down
4 changes: 2 additions & 2 deletions gensim/models/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,11 @@ def make_cum_table(self, domain=2**31 - 1):
train_words_pow = 0.0
for word_index in range(vocab_size):
count = self.wv.get_vecattr(word_index, 'count')
train_words_pow += count**self.ns_exponent
train_words_pow += count**float(self.ns_exponent)
cumulative = 0.0
for word_index in range(vocab_size):
count = self.wv.get_vecattr(word_index, 'count')
cumulative += count**self.ns_exponent
cumulative += count**float(self.ns_exponent)
self.cum_table[word_index] = round(cumulative / train_words_pow * domain)
if len(self.cum_table) > 0:
assert self.cum_table[-1] == domain
Expand Down
Loading