class_docstr: A metric defined by a generic deterministic function, with normal noise
  with mean 0 and mean_sd scale added to the result.
class_docstr_tok: ["A","metric","defined","by","a","generic","deterministic","function",",","with","normal","noise","with","mean","0","and","mean_sd","scale","added","to","the","result","."]
code: def fetch_trial_data(
      self, trial: BaseTrial, noisy: bool = True, **kwargs: Any
  ) -> MapMetricFetchResult:
      try:
          res = [
              self.f(np.fromiter(arm.parameters.values(), dtype=float))
              for arm in trial.arms
          ]
  
          df = pd.DataFrame(
              {
                  "arm_name": [arm.name for arm in trial.arms],
                  "metric_name": self.name,
                  "sem": self.noise_sd if noisy else 0.0,
                  "trial_index": trial.index,
                  "mean": [item["mean"] for item in res],
                  self.map_key_info.key: [
                      item[self.map_key_info.key] for item in res
                  ],
              }
          )
          return Ok(
              value=MapData(df=df, map_key_infos=[self.map_key_info])
          )
  
      except Exception as e:
          return Err(
              MetricFetchE(
                  message=f"Failed to fetch {self.name}", exception=e
              )
          )
  
file_path: Ax/ax/metrics/noisy_function_map.py
imports: from __future__ import annotations
  from logging import Logger
  from typing import Any, Iterable, Mapping, Optional
  import numpy
  import pandas
  from ax.core.base_trial import BaseTrial
  from ax.core.map_data import MapData, MapKeyInfo
  from ax.core.map_metric import MapMetric, MapMetricFetchResult
  from ax.core.metric import MetricFetchE
  from ax.utils.common.logger import get_logger
  from ax.utils.common.result import Err, Ok
label_desc: Use image node_id 5 for calling the NoisyFunctionMapMetric obj's underlying member method code with example usage: obj.fetch_trial_data(trial, noisy) and returns: Ok, Err