Skip to content

Commit

Permalink
Update _metrics.py
Browse files Browse the repository at this point in the history
  • Loading branch information
maximtrp authored Mar 26, 2022
1 parent 7878a02 commit 917a30d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tmplot/_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
def entropy(phi: np.ndarray):
"""Renyi entropy calculation routine [1]_.
Renyi entropy can be used to estimate the optimal number of topics: just fit
several models with a different number of topics and choose the number of
topics for which the Renyi entropy is the least.
Renyi entropy can be used to estimate the optimal number of topics: fit
several models varying the number of topics and choose the model for
which Renyi entropy is minimal.
Parameters
----------
Expand All @@ -33,8 +33,9 @@ def entropy(phi: np.ndarray):
>>> # ...
>>> # Model fitting step
>>> # model = ...
>>> # phi = ...
>>> # Entropy calculation
>>> entropy = tmp.entropy(model.matrix_topics_words_)
>>> entropy = tmp.entropy(phi)
"""
# Terms number
words_num = phi.shape[1]
Expand Down

0 comments on commit 917a30d

Please sign in to comment.