1). Does it use the Shannon Entropy function? (Not specified in documentation)
2). Does it work on 3D arrays? (Seems to).
3). What are its Min (assume 0) and Max values? (Not specified in documentation).
Thanks,
Phil
list = RandomChoice[{a, b, c}, 1000];
tallies = Tally[list]
(* {{b, 316}, {c, 331}, {a, 353}} *)
Base E (default)
Entropy[list] == -Total[#*Log[#] & /@ (tallies[[All, 2]]/Length[list])]
(* True *)
Base 2
Entropy[2, list] == -Total[#*Log2[#] & /@ (tallies[[All, 2]]/Length[list])]
(* True *)
Base 10
Entropy[10, list] == -Total[#*Log10[#] & /@ (tallies[[All, 2]]/Length[list])]
(* True *)
EDIT: The entropy is maximized when all of the choices are equally likely. For n
equally likely choices, the entropy is Log[n]/Log[b]
where b
is the base.
Log[n]/Log[b]
is the result for an arbitrary positive base. For b == E
it does simplify to Log[n]
.
$\endgroup$
Commented
Sep 2, 2022 at 18:42