class_docstr: Tests for TopKUniquesSketchStatsGenerator.
class_docstr_tok: ["Tests","for","TopKUniquesSketchStatsGenerator","."]
code: def test_topk_uniques_sketch_with_numeric_feature(self):
      # fa: 4 'a', 2 'b', 3 'c', 2 'd', 1 'e'
      batches = [
          pa.RecordBatch.from_arrays(
              [
                  pa.array(
                      [["a", "b", "c", "e"], None, ["a", "c", "d"]]
                  ),
                  pa.array([[1.0, 2.0, 3.0], [4.0, 5.0], None]),
              ],
              ["fa", "fb"],
          ),
          pa.RecordBatch.from_arrays(
              [
                  pa.array([["a", "a", "b", "c", "d"]]),
                  pa.array([None], type=pa.list_(pa.float32())),
              ],
              ["fa", "fb"],
          ),
      ]
      expected_result = {
          types.FeaturePath(["fa"]): text_format.Parse(
              """
                  path {
                    step: 'fa'
                  }
                  string_stats {
                    unique: 5
                    top_values {
                      value: 'a'
                      frequency: 4
                    }
                    top_values {
                      value: 'c'
                      frequency: 3
                    }
                    top_values {
                      value: 'd'
                      frequency: 2
                    }
                    top_values {
                      value: 'b'
                      frequency: 2
                    }
                    rank_histogram {
                      buckets {
                        low_rank: 0
                        high_rank: 0
                        label: "a"
                        sample_count: 4.0
                      }
                      buckets {
                        low_rank: 1
                        high_rank: 1
                        label: "c"
                        sample_count: 3.0
                      }
                      buckets {
                        low_rank: 2
                        high_rank: 2
                        label: "d"
                        sample_count: 2.0
                      }
                    }
                }""",
              statistics_pb2.FeatureNameStatistics(),
          )
      }
      generator = sketch_generator.TopKUniquesSketchStatsGenerator(
          num_top_values=4, num_rank_histogram_buckets=3
      )
      self.assertCombinerOutputEqual(
          batches, generator, expected_result
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import absltest
  from absl.testing import parameterized
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import top_k_uniques_sketch_stats_generator
  from tensorflow_data_validation.utils import test_util
  from tensorflow_data_validation.utils.example_weight_map import ExampleWeightMap
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 8 for calling the TopKUniquesSketchStatsGeneratorTest obj's underlying member method code with example usage: obj.test_topk_uniques_sketch_with_numeric_feature() without return types