class_docstr: Generates statistics for number unique and top-k item counts.
  
  Uses mergeable K-Minimum Values (KMV) and Misra-Gries sketches to estimate
  statistics.
class_docstr_tok: ["Generates","statistics","for","number","unique","and","top-k","item","counts",".","Uses","mergeable","K-Minimum","Values","(","KMV",")","and","Misra-Gries","sketches","to","estimate","statistics","."]
code: def extract_output(
      self, accumulator: Dict[tfdv_types.FeaturePath, _CombinedSketch]
  ) -> statistics_pb2.DatasetFeatureStatistics:
      result = statistics_pb2.DatasetFeatureStatistics()
      for feature_path, combined_sketch in accumulator.items():
          combined_estimate = combined_sketch.estimate()
          if not combined_estimate.topk_unweighted:
              assert not combined_estimate.topk_weighted
              continue
          make_feature_stats_proto = (
              top_k_uniques_stats_util.make_feature_stats_proto_topk_uniques
          )
          if self._store_output_in_custom_stats:
              make_feature_stats_proto = (
                  top_k_uniques_stats_util.make_feature_stats_proto_topk_uniques_custom_stats
              )
  
          feature_stats_proto = make_feature_stats_proto(
              feature_path=feature_path,
              frequency_threshold=self._frequency_threshold,
              weighted_frequency_threshold=self._weighted_frequency_threshold,
              num_top_values=self._num_top_values,
              num_rank_histogram_buckets=self._num_rank_histogram_buckets,
              num_unique=combined_estimate.distinct,
              value_count_list=combined_estimate.topk_unweighted,
              weighted_value_count_list=combined_estimate.topk_weighted,
          )
  
          new_feature_stats_proto = result.features.add()
          new_feature_stats_proto.CopyFrom(feature_stats_proto)
      return result
  
imports: import collections
  from typing import Dict, Iterable, Optional, Text
  import apache_beam
  import numpy
  import pyarrow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.arrow import arrow_util
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import schema_util
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_data_validation.utils import top_k_uniques_stats_util
  from tensorflow_data_validation.utils.example_weight_map import ExampleWeightMap
  from tfx_bsl.arrow import array_util
  from tfx_bsl.sketches import KmvSketch
  from tfx_bsl.sketches import MisraGriesSketch
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 7 for calling the TopKUniquesSketchStatsGenerator obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result