code: def _compute_scalarized_outcome(
      mean_dict: Dict[str, float],
      cov_dict: Dict[str, Dict[str, float]],
      agg_metric_weight_dict: Dict[str, float],
  ) -> Tuple[float, float]:
      """Compute the mean and variance of a scalarized outcome.
  
      Args:
          mean_dict: Dictionary of means of individual metrics. e.g.
              {"metric1": 0.1, "metric2": 0.2}
          cov_dict: Dictionary of covariances of each metric pair. e.g.
              {"metric1": {"metric1": 0.25, "metric2": 0.0}, "metric2": {"metric1": 0.0,
              "metric2": 0.1}}
          agg_metric_weight_dict. Dictionary of scalarization weights of the scalarized
              outcome. e.g. {"name": "metric1:agg", "weight": {"metric1_c1": 0.5,
               "metric1_c2": 0.5}}
      """
      pred_mean = 0
      pred_var = 0
      component_metrics = list(agg_metric_weight_dict.keys())
      for i, metric_name in enumerate(component_metrics):
          weight = agg_metric_weight_dict[metric_name]
          pred_mean += weight * mean_dict[metric_name]
          pred_var += (weight**2) * cov_dict[metric_name][metric_name]
          # include cross-metric covariance
          for metric_name2 in component_metrics[(i + 1) :]:
              weight2 = agg_metric_weight_dict[metric_name2]
              pred_var += (
                  2
                  * weight
                  * weight2
                  * cov_dict[metric_name][metric_name2]
              )
      return pred_mean, pred_var
  
file_path: Ax/ax/modelbridge/prediction_utils.py
imports: from __future__ import annotations
  from typing import Any, Dict, List, Optional, Set, Tuple
  import numpy
  from ax.core.observation import ObservationFeatures
  from ax.modelbridge import ModelBridge
label_desc: Use image node_id 3 for calling a global function with example usage: _compute_scalarized_outcome(mean_dict, cov_dict, agg_metric_weight_dict) and returns: pred_mean,  pred_var