code: def get_pareto_frontier_and_configs(
      modelbridge: modelbridge_module.torch.TorchModelBridge,
      observation_features: List[ObservationFeatures],
      observation_data: Optional[List[ObservationData]] = None,
      objective_thresholds: Optional[TRefPoint] = None,
      optimization_config: Optional[
          MultiObjectiveOptimizationConfig
      ] = None,
      arm_names: Optional[List[Optional[str]]] = None,
      use_model_predictions: bool = True,
      transform_outcomes_and_configs: Optional[bool] = None,
  ) -> Tuple[List[Observation], Tensor, Tensor, Optional[Tensor]]:
      """Helper that applies transforms and calls ``frontier_evaluator``.
  
      Returns the ``frontier_evaluator`` configs in addition to the Pareto
      observations.
  
      Args:
          modelbridge: ``Modelbridge`` used to predict metrics outcomes.
          observation_features: Observation features to consider for the Pareto
              frontier.
          observation_data: Data for computing the Pareto front, unless
              ``observation_features`` are provided and ``model_predictions is True``.
          objective_thresholds: Metric values bounding the region of interest in
              the objective outcome space; used to override objective thresholds
              specified in ``optimization_config``, if necessary.
          optimization_config: Multi-objective optimization config.
          arm_names: Arm names for each observation in ``observation_features``.
          use_model_predictions: If ``True``, will use model predictions at
              ``observation_features`` to compute Pareto front. If ``False``,
              will use ``observation_data`` directly to compute Pareto front, ignoring
              ``observation_features``.
          transform_outcomes_and_configs: Deprecated and must be ``False`` if provided.
              Previously, if ``True``, would transform the optimization
              config, observation features and observation data, before calling
              ``frontier_evaluator``, then will untransform all of the above before
              returning the observations.
  
      Returns: Four-item tuple of:
            - frontier_observations: Observations of points on the pareto frontier,
            - f: n x m tensor representation of the Pareto frontier values where n is the
              length of frontier_observations and m is the number of metrics,
            - obj_w: m tensor of objective weights,
            - obj_t: m tensor of objective thresholds corresponding to Y, or None if no
              objective thresholds used.
      """
      if transform_outcomes_and_configs is None:
          warnings.warn(
              "FYI: The default behavior of `get_pareto_frontier_and_configs` when "
              "`transform_outcomes_and_configs` is not specified has changed. Previously,"
              " the default was `transform_outcomes_and_configs=True`; now this argument "
              "is deprecated and behavior is as if "
              "`transform_outcomes_and_configs=False`. You did not specify "
              "`transform_outcomes_and_configs`, so this warning requires no action.",
              stacklevel=2,
          )
      elif transform_outcomes_and_configs:
          raise UnsupportedError(
              "`transform_outcomes_and_configs=True` is no longer supported, and the "
              "`transform_outcomes_and_configs` argument is deprecated. Please do not "
              "specify this argument."
          )
      else:
          warnings.warn(
              "You passed `transform_outcomes_and_configs=False`. Specifying "
              "`transform_outcomes_and_configs` at all is deprecated because `False` is "
              "now the only allowed behavior. In the future, this will become an error.",
              DeprecationWarning,
              stacklevel=2,
          )
      # Input validation
      if use_model_predictions:
          if observation_data is not None:
              warnings.warn(
                  "You provided `observation_data` when `use_model_predictions` is True; "
                  "`observation_data` will not be used.",
                  stacklevel=2,
              )
      else:
          if observation_data is None:
              raise ValueError(
                  "`observation_data` must not be None when `use_model_predictions` is "
                  "True."
              )
  
      array_to_tensor = partial(
          _array_to_tensor, modelbridge=modelbridge
      )
      if use_model_predictions:
          observation_data = modelbridge._predict_observation_data(
              observation_features=observation_features
          )
      Y, Yvar = observation_data_to_array(
          outcomes=modelbridge.outcomes,
          observation_data=not_none(observation_data),
      )
      Y, Yvar = (array_to_tensor(Y), array_to_tensor(Yvar))
      if arm_names is None:
          arm_names = [None] * len(observation_features)
  
      # Extract optimization config: make sure that the problem is a MOO
      # problem and clone the optimization config with specified
      # `objective_thresholds` if those are provided. If `optimization_config`
      # is not specified, uses the one stored on `modelbridge`.
      optimization_config = _get_multiobjective_optimization_config(
          modelbridge=modelbridge,
          optimization_config=optimization_config,
          objective_thresholds=objective_thresholds,
      )
  
      # Transform optimization config.
  
      # de-relativize outcome constraints and objective thresholds
      observations = modelbridge.get_training_data()
  
      optimization_config = checked_cast(
          MultiObjectiveOptimizationConfig,
          derelativize_optimization_config_with_raw_status_quo(
              optimization_config=optimization_config,
              modelbridge=modelbridge,
              observations=observations,
          ),
      )
      # Extract weights, constraints, and objective_thresholds
      objective_weights = extract_objective_weights(
          objective=optimization_config.objective,
          outcomes=modelbridge.outcomes,
      )
      outcome_constraints = extract_outcome_constraints(
          outcome_constraints=optimization_config.outcome_constraints,
          outcomes=modelbridge.outcomes,
      )
      obj_t = extract_objective_thresholds(
          objective_thresholds=optimization_config.objective_thresholds,
          objective=optimization_config.objective,
          outcomes=modelbridge.outcomes,
      )
      if obj_t is not None:
          obj_t = array_to_tensor(obj_t)
      # Transform to tensors.
      obj_w, oc_c, _, _, _ = validate_and_apply_final_transform(
          objective_weights=objective_weights,
          outcome_constraints=outcome_constraints,
          linear_constraints=None,
          pending_observations=None,
          final_transform=array_to_tensor,
      )
      f, cov, indx = pareto_frontier_evaluator(
          model=None,
          X=None,
          Y=Y,
          Yvar=Yvar,
          objective_thresholds=obj_t,
          objective_weights=obj_w,
          outcome_constraints=oc_c,
      )
      f, cov = f.detach().cpu().clone(), cov.detach().cpu().clone()
      indx = indx.tolist()
      frontier_observation_data = array_to_observation_data(
          f=f.numpy(),
          cov=cov.numpy(),
          outcomes=not_none(modelbridge.outcomes),
      )
      # Construct observations
      frontier_observations = []
      for i, obsd in enumerate(frontier_observation_data):
          frontier_observations.append(
              Observation(
                  features=deepcopy(observation_features[indx[i]]),
                  data=deepcopy(obsd),
                  arm_name=arm_names[indx[i]],
              )
          )
  
      return (
          frontier_observations,
          f,
          obj_w.cpu(),
          obj_t.cpu() if obj_t is not None else None,
      )
  
imports: from __future__ import annotations
  import warnings
  from copy import deepcopy
  from functools import partial
  from logging import Logger
  from typing import Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Type, TYPE_CHECKING, Union
  import numpy
  import torch
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.objective import MultiObjective, Objective, ScalarizedObjective
  from ax.core.observation import Observation, ObservationData, ObservationFeatures
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig, TRefPoint
  from ax.core.outcome_constraint import ComparisonOp, OutcomeConstraint, ScalarizedOutcomeConstraint
  from ax.core.parameter import ChoiceParameter, Parameter, ParameterType, RangeParameter
  from ax.core.parameter_constraint import ParameterConstraint
  from ax.core.risk_measures import RiskMeasure
  from ax.core.search_space import RobustSearchSpace, RobustSearchSpaceDigest, SearchSpace, SearchSpaceDigest
  from ax.core.types import TBounds, TCandidateMetadata
  from ax.core.utils import get_pending_observation_features, get_pending_observation_features_based_on_trial_status
  from ax.exceptions.core import DataRequiredError, UnsupportedError, UserInputError
  from ax.modelbridge.transforms.base import Transform
  from ax.modelbridge.transforms.utils import derelativize_optimization_config_with_raw_status_quo
  from ax.models.torch.botorch_moo_defaults import pareto_frontier_evaluator
  from ax.models.torch.frontier_utils import get_weighted_mc_objective_and_objective_thresholds
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast, checked_cast_optional, checked_cast_to_tuple, not_none
  from botorch.acquisition.multi_objective.multi_output_risk_measures import IndependentCVaR, IndependentVaR, MARS, MultiOutputExpectation, MVaR
  from botorch.acquisition.risk_measures import CVaR, Expectation, RiskMeasureMCObjective, VaR, WorstCase
  from botorch.utils.datasets import ContextualDataset, SupervisedDataset
  from botorch.utils.multi_objective.box_decompositions.dominated import DominatedPartitioning
  from torch import Tensor
label_desc: Use image node_id 14 for calling a global function with example usage: get_pareto_frontier_and_configs(modelbridge, observation_features, observation_data, objective_thresholds, optimization_config, arm_names, use_model_predictions, transform_outcomes_and_configs) and returns: frontier_observations,  f,  obj_w,  unknown