Compute the entropy, in bits, of a node from its class counts.
Implement solve(counts).
Returns. Return a non-negative float. Classes with zero count contribute nothing, and a node with no samples at all has entropy 0.0.
Example 1
Input:
solve([3, 1])
Output:
0.811278
Example 2
Input:
solve([2, 2])
Output:
1.0
Example 3
Input:
solve([4, 0])
Output:
0.0
No results yet
Run your code to check it against the examples, or submit to run every test.