entropy

entropy, function

def nosort process entropy(value: boolean): number
def nosort process entropy(value: date   ): number
def nosort process entropy(value: number ): number
def nosort process entropy(value: text   ): number

Returns the Shannon entropy (in shannons) of the values in a group.

Examples

table T = with
  [| as A, as B |]
  [| 0, "a" |]
  [| 0, "a" |]
  [| 1, "b" |]
  [| 1, "b" |]
  [| 1, "b" |]

a = entropy(T.A)
b = entropy(T.B)

table S = with
  [| as A, as B |]
  [| a, b |]

show table "Entropy" with
  S.A
  S.B

This produces the following table:

A B
0.9709506 0.9709506

Remarks

entropy returns 0 for empty groups.

See also

User Contributed Notes
0 notes + add a note