code: def _adjusted_mi_for_arrays(
      c_arrs0: List[np.ndarray],
      c_arrs1: List[np.ndarray],
      d_arrs0: List[np.ndarray],
      d_arrs1: List[np.ndarray],
      weights: Optional[np.ndarray] = None,
      k: int = 3,
      estimate_method: str = "larger_data",
      seed: Optional[int] = None,
  ) -> float:
      """Computes AdjustedMutualInformation for given np.ndarrays.
  
      Args:
        c_arrs0: Continuous arrays for side 0.
        c_arrs1: Continuous arrays for side 1.
        d_arrs0: Discrete arrays for side 0.
        d_arrs1: Discrete arrays for side 1.
        weights: Weights for data points.
        k: The number of nearest neighbors to check when computing MI.
        estimate_method: Underlying estimate method for computing MI.
        seed: The seed for RNGs.
  
      Returns:
        AMI
      """
      if seed is not None:
          np.random.seed(seed)
  
      # Always set `output_each` to be False.
      seed1 = None if seed is None else np.random.randint(0, 1000)
      mi, _ = _mi_for_arrays(
          c_arrs0,
          c_arrs1,
          d_arrs0,
          d_arrs1,
          weights,
          k,
          estimate_method,
          seed1,
      )
  
      # We use the same seed to shuffle several features together.
      shuffle_seed = np.random.randint(
          0, 1000
      )  # a fixed seed for shuffling
      array_length = next(
          itertools.chain(c_arrs0, c_arrs1, d_arrs0, d_arrs1)
      ).size
      np.random.seed(shuffle_seed)
      shuffled_index = np.random.permutation(array_length)
  
      shuffled_c_arrs0 = [a[shuffled_index] for a in c_arrs0]
      shuffled_d_arrs0 = [a[shuffled_index] for a in d_arrs0]
  
      seed2 = None if seed is None else np.random.randint(0, 1000)
      mi_shuffled, _ = _mi_for_arrays(
          shuffled_c_arrs0,
          c_arrs1,
          shuffled_d_arrs0,
          d_arrs1,
          weights,
          k,
          estimate_method,
          seed2,
      )
  
      return max(mi - mi_shuffled, 0.0)
  
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 4 for calling a global function with example usage: _adjusted_mi_for_arrays(c_arrs0, c_arrs1, d_arrs0, d_arrs1, weights, k, estimate_method, seed) and returns: max