September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,7 +1,7 @@
|
|||
;Task:
|
||||
Calculate the Shannon entropy H of a given input string.
|
||||
|
||||
Given the discreet random variable <math>X</math> that is a string of <math>N</math> "symbols" (total characters) consisting of <math>n</math> different characters (n=2 for binary), the Shannon entropy of X in '''bits/symbol''' is :
|
||||
Given the discrete random variable <math>X</math> that is a string of <math>N</math> "symbols" (total characters) consisting of <math>n</math> different characters (n=2 for binary), the Shannon entropy of X in '''bits/symbol''' is :
|
||||
:<math>H_2(X) = -\sum_{i=1}^n \frac{count_i}{N} \log_2 \left(\frac{count_i}{N}\right)</math>
|
||||
|
||||
where <math>count_i</math> is the count of character <math>n_i</math>.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue