code: def _entropy_discrete(
      discrete_f: np.ndarray, weight_f: np.ndarray
  ) -> Tuple[float, np.ndarray]:
      """Computes the entropy of a list of categorical features with weights."""
      _, inverse_idx, unique_counts = np.unique(
          discrete_f, return_inverse=True, return_counts=True
      )
      group_counts = unique_counts[inverse_idx]
      each = -np.log2(group_counts / discrete_f.size) * weight_f
      return np.mean(each), each
  
imports: import functools
  import itertools
  import math
  from typing import Any, List, Optional, Tuple, Union
  import uuid
  import numpy
  import pandas
  import scipy.special
  import sklearn.neighbors
label_desc: Use image node_id 9 for calling a global function with example usage: _entropy_discrete(discrete_f, weight_f) and returns: np,  each