code: def information_gain(
      X, y, attribute, threshold, parent_entropy, n_classes
  ):
      """Information gain function."""
      dist_left = np.zeros(n_classes)
      dist_right = np.zeros(n_classes)
      dist_missing = np.zeros(n_classes)
      for i, case in enumerate(X):
          if case[attribute] <= threshold:
              dist_left[y[i]] += 1
          elif case[attribute] > threshold:
              dist_right[y[i]] += 1
          else:
              dist_missing[y[i]] += 1
  
      sum_missing = 0
      for v in dist_missing:
          sum_missing += v
      sum_left = 0
      for v in dist_left:
          sum_left += v
      sum_right = 0
      for v in dist_right:
          sum_right += v
  
      entropy_left = _entropy(dist_left, sum_left)
      entropy_right = _entropy(dist_right, sum_right)
      entropy_missing = _entropy(dist_missing, sum_missing)
  
      num_cases = X.shape[0]
      info_gain = (
          parent_entropy
          - sum_left / num_cases * entropy_left
          - sum_right / num_cases * entropy_right
          - sum_missing / num_cases * entropy_missing
      )
  
      return (
          info_gain,
          [dist_left, dist_right, dist_missing],
          [entropy_left, entropy_right, entropy_missing],
      )
  
file_path: sktime/sktime/classification/sklearn/_continuous_interval_tree_numba.py
imports: import math
  import numpy
  from sktime.utils.numba.njit import njit
  from sktime.utils.numba.stats import iqr, mean, numba_max, numba_min, slope, std
label_desc: Use image node_id 4 for calling a global function with example usage: information_gain(X, y, attribute, threshold, parent_entropy, n_classes) and returns: info_gain,  list,  list