class_docstr: Clip the mean values for each metric to lay within the limits provided in
  the config. The config can contain either or both of two keys:
  - ``"winsorization_config"``, corresponding to either a single
      ``WinsorizationConfig``, which, if provided will be used for all metrics; or
      a mapping ``Dict[str, WinsorizationConfig]`` between each metric name and its
      ``WinsorizationConfig``.
  - ``"derelativize_with_raw_status_quo"``, indicating whether to use the raw
      status-quo value for any derelativization. Note this defaults to ``False``,
      which is unsupported and simply fails if derelativization is necessary. The
      user must specify ``derelativize_with_raw_status_quo = True`` in order for
      derelativization to succeed. Note that this must match the `use_raw_status_quo`
      value in the ``Derelativize`` config if used.
  For example,
  ``{"winsorization_config": WinsorizationConfig(lower_quantile_margin=0.3)}``
  will specify the same 30% winsorization from below for all metrics, whereas
  ```
  {
      "winsorization_config":
      {
          "metric_1": WinsorizationConfig(lower_quantile_margin=0.2),
          "metric_2": WinsorizationConfig(upper_quantile_margin=0.1),
      }
  }
  ```
  will winsorize 20% from below for metric_1 and 10% from above from metric_2.
  Additional metrics won't be winsorized.
  
  You can also determine the winsorization cutoffs automatically without having an
  ``OptimizationConfig`` by passing in AUTO_WINS_QUANTILE for the quantile you want
  to winsorize. For example, to automatically winsorize large values:
      ``"m1": WinsorizationConfig(upper_quantile_margin=AUTO_WINS_QUANTILE)``.
  This may be useful when fitting models in a notebook where there is no corresponding
  ``OptimizationConfig``.
  
  Additionally, you can pass in winsorization boundaries ``lower_boundary`` and
  ``upper_boundary``that specify a maximum allowable amount of winsorization. This
  is discouraged and will eventually be deprecated as we strongly encourage
  that users allow ``Winsorize`` to automatically infer these boundaries from
  the optimization config.
code: def __init__(
      self,
      search_space: Optional[SearchSpace] = None,
      observations: Optional[List[Observation]] = None,
      modelbridge: Optional[
          "modelbridge_module.base.ModelBridge"
      ] = None,
      config: Optional[TConfig] = None,
  ) -> None:
      if observations is None or len(observations) == 0:
          raise DataRequiredError(
              "`Winsorize` transform requires non-empty data."
          )
      if (
          config is not None
          and config.get("optimization_config") is not None
      ):
          warnings.warn(
              "Winsorization received an out-of-date `transform_config`, containing "
              'the key `"optimization_config"`. Please update the config according '
              "to the docs of `ax.modelbridge.transforms.winsorize.Winsorize`.",
              DeprecationWarning,
          )
      optimization_config = (
          modelbridge._optimization_config if modelbridge else None
      )
      if config is None and optimization_config is None:
          raise ValueError(
              "Transform config for `Winsorize` transform must be specified and "
              "non-empty when using winsorization, or a modelbridge containing an "
              "optimization_config must be provided."
          )
      if config is None:
          config = {}
      observation_data = [obs.data for obs in observations]
  
      # Check for legacy config
      use_legacy = False
      old_present = set(OLD_KEYS).intersection(config.keys())
      if old_present:
          warnings.warn(
              "Winsorization received an out-of-date `transform_config`, containing "
              f"the following deprecated keys: {old_present}. Please update the "
              "config according to the docs of "
              "`ax.modelbridge.transforms.winsorize.Winsorize`.",
              DeprecationWarning,
          )
          use_legacy = True
  
      # Get config settings.
      winsorization_config = config.get("winsorization_config", {})
      use_raw_sq = _get_and_validate_use_raw_sq(config=config)
      self.cutoffs = {}
      all_metric_values = get_data(observation_data=observation_data)
      for metric_name, metric_values in all_metric_values.items():
          if use_legacy:
              self.cutoffs[
                  metric_name
              ] = _get_cutoffs_from_legacy_transform_config(
                  metric_name=metric_name,
                  metric_values=metric_values,
                  transform_config=config,
              )
          else:
              self.cutoffs[metric_name] = _get_cutoffs(
                  metric_name=metric_name,
                  metric_values=metric_values,
                  winsorization_config=winsorization_config,
                  modelbridge=modelbridge,
                  observations=observations,
                  optimization_config=optimization_config,
                  use_raw_sq=use_raw_sq,
              )
  
imports: import warnings
  from logging import Logger
  from typing import Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from ax.core.objective import MultiObjective, ScalarizedObjective
  from ax.core.observation import Observation, ObservationData
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ComparisonOp, ObjectiveThreshold, OutcomeConstraint, ScalarizedOutcomeConstraint
  from ax.core.search_space import SearchSpace
  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, get_data
  from ax.models.types import TConfig, WinsorizationConfig
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast
label_desc: Use image node_id 1 to create a new Winsorize object from inherited base classes: Transform with example: obj = Winsorize(search_space, observations, modelbridge, config)