Skip to content

Commit

Permalink
feat: fixed entropy calculation
Browse files Browse the repository at this point in the history
Wermutton committed Sep 29, 2023
1 parent 6178d2a commit 33019eb
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion langdiversity/measures/shannon_entropy.py
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@ class ShannonEntropyMeasure(AbstractMeasure):
def generate(self, values: List[Hashable]) -> float:
probabilities = empirical_probability(values=values)
entropy = -sum(probability * log2(probability) for probability in probabilities.values() if probability > 0)
return entropy
return abs(entropy)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
setup(
name='langdiversity',
packages=find_packages(exclude=['tests']),
version='1.1.1',
version='1.1.2',
description='A tool to elevate your language models with insightful diversity metrics.',
long_description=long_description,
long_description_content_type="text/markdown",

0 comments on commit 33019eb

Please sign in to comment.