code: def ComputeWithConfidenceIntervals(  # pylint: disable=invalid-name
      sliced_extracts: beam.pvalue.PCollection[
          Tuple[slicer.SliceKeyType, types.Extracts]
      ],
      computations_combine_fn: beam.CombineFn,
      derived_metrics_ptransform: beam.PTransform,
      num_bootstrap_samples: int,
      hot_key_fanout: Optional[int] = None,
      skip_ci_metric_keys: Optional[Set[metric_types.MetricKey]] = None,
      random_seed_for_testing: Optional[int] = None,
  ) -> beam.pvalue.PCollection[
      Tuple[
          slicer.SliceKeyOrCrossSliceKeyType, metric_types.MetricsDict
      ]
  ]:
      """PTransform for computing metrics using T-Distribution values.
  
      Args:
        sliced_extracts: Incoming PCollection consisting of slice key and extracts.
        computations_combine_fn: a beam.CombineFn instance that takes input elements
          of type Extracts and returns a MetricsDict. This will be invoked as part
          of a CombinePerKey in which the key is a slice key.
        derived_metrics_ptransform: A PTransform which adds derived metrics to the
          results of the computations_combine_fn. This PTransform should both input
          and output a single PCollection with elements of type MetricsDict where
          the output MetricsDict includes additional derived metrics.
        num_bootstrap_samples: The number of bootstrap replicates to use in
          computing the bootstrap standard error.
        hot_key_fanout: The hot key fanout factor to use when calling
          beam.CombinePerKey with the computations_combine_fn on replicates. Note
          that these replicates will in expectation have the same size as the input
          PCollection of extracts and will use the normal set of slices keys.
        skip_ci_metric_keys: Set of metric keys for which to skip confidence
          interval computation. For metric keys in this set, just the unsampled
          value will be returned.
        random_seed_for_testing: Seed to use for unit testing, because
          nondeterministic tests stink. Each partition will use this value + i.
  
      Returns:
        PCollection of (slice key, dict of metrics)
      """
      if num_bootstrap_samples < 1:
          raise ValueError(
              "num_bootstrap_samples should be > 0, got %d"
              % num_bootstrap_samples
          )
  
      unsampled_metrics = (
          sliced_extracts
          | "CombineUnsampledMetricsPerSlice"
          >> beam.CombinePerKey(
              computations_combine_fn
          ).with_hot_key_fanout(hot_key_fanout)
          | "AddDerivedMetrics" >> derived_metrics_ptransform
          | "AddUnsampledSampleId"
          >> beam.MapTuple(_add_sample_id, _FULL_SAMPLE_ID)
      )
  
      sampled_metrics = []
      for sample_id in range(num_bootstrap_samples):
          seed = (
              None
              if random_seed_for_testing is None
              else random_seed_for_testing + sample_id
          )
          sampled_metrics.append(
              sliced_extracts
              | f"ComputeBootstrapSample[{sample_id}]"
              >> _ComputeBootstrapSample(  # pylint: disable=no-value-for-parameter
                  sample_id=sample_id,
                  computations_combine_fn=computations_combine_fn,
                  derived_metrics_ptransform=derived_metrics_ptransform,
                  seed=seed,
                  hot_key_fanout=hot_key_fanout,
              )
          )
  
      return (
          sampled_metrics + [unsampled_metrics]
          | "FlattenBootstrapPartitions" >> beam.Flatten()
          | "CombineSamplesPerSlice"
          >> beam.CombinePerKey(
              _BootstrapSampleCombineFn(
                  num_bootstrap_samples=num_bootstrap_samples,
                  skip_ci_metric_keys=skip_ci_metric_keys,
              )
          )
      )
  
file_path: model-analysis/tensorflow_model_analysis/evaluators/poisson_bootstrap.py
imports: from typing import Any, Optional, Set, Tuple, TypeVar
  import apache_beam
  import numpy
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.evaluators import confidence_intervals_util
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.utils import beam_util
label_desc: Use image node_id 3 for calling a global function with example usage: ComputeWithConfidenceIntervals(sliced_extracts, computations_combine_fn, derived_metrics_ptransform, num_bootstrap_samples, hot_key_fanout, skip_ci_metric_keys, random_seed_for_testing) and returns: unknown