Compute the entropy of a discrete sample

H(cl)

Arguments

cl

vector of discrete labels

Value

the entropy of the sample

Examples

cl <- sample(2, 500, replace = TRUE)
H(cl)
#> [1] 0.6931392