Skip to content

Commit

Permalink
Update core.py
Browse files Browse the repository at this point in the history
the cds formula seems to be reversed. See valentinp72#4
  • Loading branch information
xiaoouwang authored Jan 7, 2022
1 parent c97998d commit 3cbd1cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion svd2vec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def build_vocabulary(self, documents):
bar.update()
self.d_alpha = np.sum(np.power([self.terms_counts[c] for c in self.terms_counts], self.cds_alpha))
bar.update()
self.terms_counts_cds_powered = {word: self.d_alpha / np.power(self.terms_counts[word], self.cds_alpha) for word in self.terms_counts}
self.terms_counts_cds_powered = {word: np.power(self.terms_counts[word], self.cds_alpha) / self.d_alpha for word in self.terms_counts}
bar.update()

self.vocabulary = OrderedDict([(w, i) for i, (w, c) in enumerate(self.terms_counts.most_common())])
Expand Down

0 comments on commit 3cbd1cd

Please sign in to comment.