Skip to content

Commit

Permalink
fix: tfidf bug
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Jan 24, 2019
1 parent e14084d commit 446cf72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cophi/model.py
Expand Up @@ -504,7 +504,7 @@ def tfidf(self):
tf_{t,d} \times log(\frac{N}{df_t})
"""
tf = self.rel
idf = self.stats["documents"] / self.dtm.astype(bool).sum(axis=0)
idf = self.stats["documents"] / self.dtm.fillna(0).astype(bool).sum(axis=0)
return tf * np.log(idf)

@property
Expand Down

0 comments on commit 446cf72

Please sign in to comment.