code: def entropy(
      labels: Iterable, base: Number = None, normalized: bool = False
  ) -> Number:
      """Computes entropy of label distribution.
  
      Args:
          labels (Iterable): Labels to compute entropy.
          base (Number, optional): Logarithmic base. Defaults to None.
          normalized (bool, optional): Return normalized entropy instead. Defaults to False.
  
      Returns:
          Number: Entropy.
      """
  
      n_labels = len(labels)
  
      if n_labels <= 1:
          return 0
  
      value, counts = np.unique(labels, return_counts=True)
      probs = counts / n_labels
      n_classes = np.count_nonzero(probs)
  
      if n_classes <= 1:
          return 0
  
      ent = 0.0
  
      # Compute entropy
      base = e if base is None else base
      for i in probs:
          ent -= i * log(i, base)
  
      if normalized:
          return ent / log(len(value), base)
      else:
          return ent
  
file_path: interpret/python/powerlift/src/powerlift/measures/task_measures.py
imports: from math import log, e
  from numbers import Number
  from typing import Iterable, List, Tuple
  import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: entropy(labels, base, normalized) and returns: int, int, unknown, ent