All problems
Min-Entropy
Problem
Return the min-entropy in bits of a probability distribution:
H_min = -log2(max(p))
The min-entropy is governed by the single most likely outcome rather than by the whole distribution.
Hint
Min-entropy is never larger than Shannon entropy.
Test cases
case 1
in: [[0.5,0.5]]
expected: 1
case 2
in: [[0.25,0.75]]
expected: 0.4150374992788438
case 3
in: [[1]]
expected: 0
case 4
in: [[0.1,0.2,0.7]]
expected: 0.5145731728297583
Starter codePython
import math
def min_entropy(probs):
# Your code here
pass4 test cases · run your code against them in the editor