From 3cbd1cdb1d3fd39a54d20f4e3395fda6b736956a Mon Sep 17 00:00:00 2001 From: Xiaoou WANG Date: Fri, 7 Jan 2022 14:55:53 +0100 Subject: [PATCH] Update core.py the cds formula seems to be reversed. See #4 --- svd2vec/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svd2vec/core.py b/svd2vec/core.py index 163c9eb..2ceed9d 100644 --- a/svd2vec/core.py +++ b/svd2vec/core.py @@ -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())])