Skip to content

Commit 8103be1

Browse files
authored
Reorganize imports and add Shannon entropy function
1 parent 34bfe69 commit 8103be1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎maths/entropy.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
from __future__ import annotations
2-
3-
import math
4-
from collections import Counter
5-
61
"""
72
In information theory, entropy is a measure of the uncertainty or randomness of a
83
source of data. It quantifies the expected amount of information contained in each
@@ -18,6 +13,10 @@
1813
1914
Reference: https://en.wikipedia.org/wiki/Entropy_(information_theory)
2015
"""
16+
from __future__ import annotations
17+
18+
import math
19+
from collections import Counter
2120

2221

2322
def shannon_entropy(probabilities: list[float]) -> float:

0 commit comments

Comments
 (0)