x <- 1/8 ep <- -x * log(x, base=2) * 8 ep
buys <- c("no", "no", "yes", "yes", "yes", "no", "yes", "no", "yes", "yes", "yes", "yes", "yes", "no") freqs <- table(buys)/length(buys) ep <- -sum(freqs * log2(freqs)) ep