class_docstr: A transform statistics generator that computes top-k and uniques.
class_docstr_tok: ["A","transform","statistics","generator","that","computes","top-k","and","uniques","."]
docstr: Initializes top-k and uniques stats generator.
  
  Args:
    name: An optional unique name associated with the statistics generator.
    schema: An optional schema for the dataset.
    example_weight_map: An optional feature name whose numeric value
        (must be of type INT or FLOAT) represents the weight of an example.
    num_top_values: An optional number of most frequent feature values to keep
        for string features (defaults to 2).
    frequency_threshold: An optional minimum number of examples
      the most frequent values must be present in (defaults to 1).
    weighted_frequency_threshold: An optional minimum weighted
      number of examples the most frequent weighted values must be
      present in (defaults to 1.0).
    num_rank_histogram_buckets: An optional number of buckets in the rank
        histogram for string features (defaults to 1000).
docstr_tok: ["Initializes","top-k","and","uniques","stats","generator",".","Args",":","name",":","An","optional","unique","name","associated","with","the","statistics","generator",".","schema",":","An","optional","schema","for","the","dataset",".","example_weight_map",":","An","optional","feature","name","whose","numeric","value","(","must","be","of","type","INT","or","FLOAT",")","represents","the","weight","of","an","example",".","num_top_values",":","An","optional","number","of","most","frequent","feature","values","to","keep","for","string","features","(","defaults","to","2",")",".","frequency_threshold",":","An","optional","minimum","number","of","examples","the","most","frequent","values","must","be","present","in","(","defaults","to","1",")",".","weighted_frequency_threshold",":","An","optional","minimum","weighted","number","of","examples","the","most","frequent","weighted","values","must","be","present","in","(","defaults","to","1.0",")",".","num_rank_histogram_buckets",":","An","optional","number","of","buckets","in","the","rank","histogram","for","string","features","(","defaults","to","1000",")","."]
code: def __init__(
      self,
      name: Text = "TopKUniquesStatsGenerator",
      schema: Optional[schema_pb2.Schema] = None,
      example_weight_map: ExampleWeightMap = ExampleWeightMap(),
      num_top_values: int = 2,
      frequency_threshold: int = 1,
      weighted_frequency_threshold: float = 1.0,
      num_rank_histogram_buckets: int = 1000,
  ) -> None:
      """Initializes top-k and uniques stats generator.
  
      Args:
        name: An optional unique name associated with the statistics generator.
        schema: An optional schema for the dataset.
        example_weight_map: An optional feature name whose numeric value
            (must be of type INT or FLOAT) represents the weight of an example.
        num_top_values: An optional number of most frequent feature values to keep
            for string features (defaults to 2).
        frequency_threshold: An optional minimum number of examples
          the most frequent values must be present in (defaults to 1).
        weighted_frequency_threshold: An optional minimum weighted
          number of examples the most frequent weighted values must be
          present in (defaults to 1.0).
        num_rank_histogram_buckets: An optional number of buckets in the rank
            histogram for string features (defaults to 1000).
      """
      super(TopKUniquesStatsGenerator, self).__init__(
          name,
          schema=schema,
          ptransform=_ComputeTopKUniquesStats(
              schema=schema,
              example_weight_map=example_weight_map,
              num_top_values=num_top_values,
              frequency_threshold=frequency_threshold,
              weighted_frequency_threshold=weighted_frequency_threshold,
              num_rank_histogram_buckets=num_rank_histogram_buckets,
          ),
      )
  
imports: import logging
  from typing import Any, FrozenSet, Iterable, Iterator, Mapping, Optional, Text, Tuple, Union
  import apache_beam
  import numpy
  import pandas
  import pyarrow
  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 tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 1 to create a new TopKUniquesStatsGenerator object from inherited base classes: stats_generator with example: obj = TopKUniquesStatsGenerator(name, schema, example_weight_map, num_top_values, frequency_threshold, weighted_frequency_threshold, num_rank_histogram_buckets)