Skip to content

Commit 1921de5

Browse files
Fix documentation of entropy function
Fix the documentation of the entropy function to correct the formula so it reflects the calculation used in the code. Also mention the unit of the value returned,
1 parent 4edc4c2 commit 1921de5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/mlab.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,11 @@ def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none,
15251525

15261526
def entropy(y, bins):
15271527
r"""
1528-
Return the entropy of the data in *y*.
1528+
Return the entropy of the data in *y* in units of nat.
15291529
15301530
.. math::
15311531
1532-
\sum p_i \log_2(p_i)
1532+
-\sum p_i \ln(p_i)
15331533
15341534
where :math:`p_i` is the probability of observing *y* in the
15351535
:math:`i^{th}` bin of *bins*. *bins* can be a number of bins or a

0 commit comments

Comments
 (0)