Difficulty: Easy Tags: Information Theory
Stripe's risk team runs a daily check on how "surprising" the label mix looks: entropy near zero means the day was almost entirely one class, worth a glance before trusting any model metric computed on it.
H(p) = -sum_i p_i * log2(p_i)
k
p_1 ... p_k
A valid probability distribution, given directly.
H(p), 6 decimals.
2 <= k <= 100, sum(p_i) = 1 guaranteed within 1e-6Input
2
0.995 0.005
Output
0.045415
No results yet
Run your code to check it against the examples, or submit to run every test.