class_docstr: Computes the standard deviation for each metric from samples.
class_docstr_tok: ["Computes","the","standard","deviation","for","each","metric","from","samples","."]
code: def _validate_accumulator(
      self, accumulator: "SampleCombineFn.SampleAccumulator"
  ) -> "SampleCombineFn.SampleAccumulator":
      self._num_slices_counter.inc(1)
      error_metric_key = metric_types.MetricKey(
          metric_keys.ERROR_METRIC
      )
      if accumulator.num_samples < self._num_samples:
          self._missing_samples_counter.inc(1)
          accumulator.point_estimates[error_metric_key] = (
              f"CI not computed because only {accumulator.num_samples} samples "
              f"were non-empty. Expected {self._num_samples}."
          )
          # If we are missing samples, clear samples for all metrics as they are all
          # unusable.
          accumulator.metric_samples = {}
      # Check that all metrics were present in all samples
      metric_incorrect_sample_counts = {}
      for metric_key in accumulator.point_estimates:
          if metric_key in accumulator.metric_samples:
              actual_num_samples = len(
                  accumulator.metric_samples[metric_key]
              )
              if actual_num_samples != self._num_samples:
                  # If we are missing a per-metric sample, clear samples for tha metric
                  # as it is unusable.
                  del accumulator.metric_samples[metric_key]
                  metric_incorrect_sample_counts[
                      metric_key
                  ] = actual_num_samples
      if metric_incorrect_sample_counts:
          accumulator.point_estimates[error_metric_key] = (
              "CI not computed for the following metrics due to incorrect number "
              f'of samples: "{metric_incorrect_sample_counts}".'
              f"Expected {self._num_samples}."
          )
      return accumulator
  
file_path: model-analysis/tensorflow_model_analysis/evaluators/confidence_intervals_util.py
imports: import collections
  import numbers
  from typing import Iterable, NamedTuple, Optional, Sequence, Set, Tuple
  import apache_beam
  import numpy
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.post_export_metrics import metric_keys
label_desc: Use image node_id 5 for calling the SampleCombineFn obj's underlying member method code with example usage: obj._validate_accumulator(accumulator) and returns: accumulator