class_docstr: Information Gain split criterion.
  
  A measure of how often a randomly chosen element from the set would be
  incorrectly labeled if it was randomly labeled according to the
  distribution of labels in the subset.
  
  References
  ----------
  [Wikipedia entry](https://en.wikipedia.org/wiki/Decision_tree_learning#Information_gain)
class_docstr_tok: ["Information","Gain","split","criterion",".","A","measure","of","how","often","a","randomly","chosen","element","from","the","set","would","be","incorrectly","labeled","if","it","was","randomly","labeled","according","to","the","distribution","of","labels","in","the","subset",".","References","--","--","--","--","--","[","Wikipedia","entry","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Decision_tree_learning","#","Information_gain",")"]
code: def _compute_entropy_dict(dist):
      entropy = 0.0
      dis_sums = 0.0
      for _, d in dist.items():
          if d > 0.0:  # TODO: How small can d be before log2 overflows?
              entropy -= d * math.log2(d)
              dis_sums += d
      return (
          (entropy + dis_sums * math.log2(dis_sums)) / dis_sums
          if dis_sums > 0.0
          else 0.0
      )
  
file_path: river/river/tree/split_criterion/info_gain_split_criterion.py
imports: from __future__ import annotations
  import math
  from .base import SplitCriterion
label_desc: Use image node_id 5 for calling the InfoGainSplitCriterion obj's underlying member method code with example usage: obj._compute_entropy_dict(dist) and returns: unknown