code: def infer_is_relative(
      model: ModelBridge, metrics: List[str], non_constraint_rel: bool
  ) -> Dict[str, bool]:
      """Determine whether or not to relativize a metric.
  
      Metrics that are constraints will get this decision from their `relative` flag.
      Other metrics will use the `default_rel`.
  
      Args:
          model: model fit on metrics.
          metrics: list of metric names.
          non_constraint_rel: whether or not to relativize non-constraint metrics
  
      Returns:
          Dict[str, bool] containing whether or not to relativize each input metric.
      """
      relative = {}
      constraint_relativity = {}
      if model._optimization_config:
          constraints = not_none(
              model._optimization_config
          ).outcome_constraints
          constraint_relativity = {
              constraint.metric.name: constraint.relative
              for constraint in constraints
          }
      for metric in metrics:
          if metric not in constraint_relativity:
              relative[metric] = non_constraint_rel
          else:
              relative[metric] = constraint_relativity[metric]
      return relative
  
imports: import math
  from collections import Counter
  from logging import Logger
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
  import numpy
  from ax.core.generator_run import GeneratorRun
  from ax.core.observation import Observation, ObservationFeatures
  from ax.core.parameter import ChoiceParameter, FixedParameter, Parameter, ParameterType, RangeParameter
  from ax.core.types import TParameterization
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.prediction_utils import _compute_scalarized_outcome, predict_at_point
  from ax.modelbridge.transforms.ivw import IVW
  from ax.plot.base import DECIMALS, PlotData, PlotInSampleArm, PlotOutOfSampleArm, Z
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 22 for calling a global function with example usage: infer_is_relative(model, metrics, non_constraint_rel) and returns: relative