class_docstr: Computes the jackknife standard error for each metric from samples.
class_docstr_tok: ["Computes","the","jackknife","standard","error","for","each","metric","from","samples","."]
code: def extract_output(
      self,
      accumulator: confidence_intervals_util.SampleCombineFn.SampleAccumulator,
  ) -> metric_types.MetricsDict:
      accumulator = self._validate_accumulator(accumulator)
      result = {}
      num_buckets = self._num_samples
      for key, point_estimate in accumulator.point_estimates.items():
          if key not in accumulator.metric_samples:
              result[key] = point_estimate
          else:
              # See jackknife cookie bucket method described in:
              # go/rasta-confidence-intervals
              pseudo_values = []
              total = None
              for sample_value in accumulator.metric_samples[key]:
                  if total is None:
                      total = sample_value
                  else:
                      total = total + sample_value
                  pseudo_values.append(
                      point_estimate * num_buckets
                      - sample_value * (num_buckets - 1)
                  )
              _, std_dev = confidence_intervals_util.mean_and_std(
                  pseudo_values, ddof=1
              )
              # Here we use Student's t-distribution to estimate the standard
              # error with n - 1 degrees of freedom as S.E. = S.D. / sqrt(n)a
              # In the case of the delete-d jackknife, the standard error is inversely
              # proprotional to the square root of the number of data partitions.
              std_error = std_dev / (num_buckets**0.5)
              mean = total / num_buckets
              result[key] = types.ValueWithTDistribution(
                  sample_mean=mean,
                  sample_standard_deviation=std_error,
                  unsampled_value=point_estimate,
                  sample_degrees_of_freedom=num_buckets - 1,
              )
      return result
  
imports: from typing import 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 2 for calling the _JackknifeSampleCombineFn obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result