We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cfb62d commit 274b629Copy full SHA for 274b629
learning.py
@@ -317,9 +317,8 @@ def split_by(attr, examples):
317
318
def information_content(values):
319
"Number of bits to represent the probability distribution in values."
320
- # If the values do not sum to 1, normalize them to make them a Prob. Dist.
321
- values = normalize(removeall(0, values))
322
- return sum([- v * log2(v) for v in values])
+ probabilities = normalize(removeall(0, values))
+ return sum(-p * log2(p) for p in probabilities)
323
324
#______________________________________________________________________________
325
0 commit comments