code: def inverse_variance_weight(
      means: np.ndarray,
      variances: np.ndarray,
      conflicting_noiseless: str = "warn",
  ) -> Tuple[float, float]:
      """Perform inverse variance weighting.
  
      Args:
          means: The means of the observations.
          variances: The variances of the observations.
          conflicting_noiseless: How to handle the case of
              multiple observations with zero variance but different means.
              Options are "warn" (default), "ignore" or "raise".
  
      """
      if conflicting_noiseless not in {"warn", "ignore", "raise"}:
          raise ValueError(
              f"Unsupported option `{conflicting_noiseless}` for conflicting_noiseless."
          )
      if len(means) != len(variances):
          raise ValueError(
              "Means and variances must be of the same length."
          )
      # new_mean = \sum_i 1/var_i mean_i / \sum_i (1/var_i), unless any var = 0,
      # in which case we report the mean of all values with var = 0.
      idx_zero = variances == 0
      if idx_zero.any():
          means_z = means[idx_zero]
          if np.var(means_z) > 0:
              message = "Multiple observations zero variance but different means."
              if conflicting_noiseless == "warn":
                  logger.warning(message)
              elif conflicting_noiseless == "raise":
                  raise ValueError(message)
          return np.mean(means_z), 0
      inv_vars = np.divide(1.0, variances)
      sum_inv_vars = inv_vars.sum()
      new_mean = np.inner(inv_vars, means) / sum_inv_vars
      new_var = np.divide(1.0, sum_inv_vars)
      return new_mean, new_var
  
file_path: Ax/ax/utils/stats/statstools.py
imports: from logging import Logger
  from typing import List, Tuple, Union
  import numpy
  import pandas
  from ax.core.data import Data
  from ax.utils.common.logger import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: inverse_variance_weight(means, variances, conflicting_noiseless) and returns: new_mean,  new_var, np,  int