code: def test_valid_stats_options_json_round_trip(self):
      feature_allowlist = ["a"]
      schema = schema_pb2.Schema(feature=[schema_pb2.Feature(name="f")])
      vocab_paths = {"a": "/path/to/a"}
      label_feature = "label"
      weight_feature = "weight"
      sample_rate = 0.01
      num_top_values = 21
      frequency_threshold = 2
      weighted_frequency_threshold = 2.0
      num_rank_histogram_buckets = 1001
      num_values_histogram_buckets = 11
      num_histogram_buckets = 11
      num_quantiles_histogram_buckets = 11
      epsilon = 0.02
      infer_type_from_schema = True
      desired_batch_size = 100
      enable_semantic_domain_stats = True
      semantic_domain_stats_sample_rate = 0.1
      per_feature_weight_override = {types.FeaturePath(["a"]): "w"}
      add_default_generators = True
      use_sketch_based_topk_uniques = True
      experimental_result_partitions = 3
      slicing_config = text_format.Parse(
          """
          slicing_specs {
            feature_keys: ["country", "city"]
          }
          """,
          slicing_spec_pb2.SlicingConfig(),
      )
  
      options = stats_options.StatsOptions(
          feature_allowlist=feature_allowlist,
          schema=schema,
          vocab_paths=vocab_paths,
          label_feature=label_feature,
          weight_feature=weight_feature,
          sample_rate=sample_rate,
          num_top_values=num_top_values,
          frequency_threshold=frequency_threshold,
          weighted_frequency_threshold=weighted_frequency_threshold,
          num_rank_histogram_buckets=num_rank_histogram_buckets,
          num_values_histogram_buckets=num_values_histogram_buckets,
          num_histogram_buckets=num_histogram_buckets,
          num_quantiles_histogram_buckets=num_quantiles_histogram_buckets,
          epsilon=epsilon,
          infer_type_from_schema=infer_type_from_schema,
          desired_batch_size=desired_batch_size,
          enable_semantic_domain_stats=enable_semantic_domain_stats,
          semantic_domain_stats_sample_rate=semantic_domain_stats_sample_rate,
          per_feature_weight_override=per_feature_weight_override,
          add_default_generators=add_default_generators,
          experimental_use_sketch_based_topk_uniques=use_sketch_based_topk_uniques,
          experimental_result_partitions=experimental_result_partitions,
          slicing_config=slicing_config,
      )
  
      options_json = options.to_json()
      options = stats_options.StatsOptions.from_json(options_json)
  
      self.assertEqual(feature_allowlist, options.feature_allowlist)
      compare.assertProtoEqual(self, schema, options.schema)
      self.assertEqual(vocab_paths, options.vocab_paths)
      self.assertEqual(label_feature, options.label_feature)
      self.assertEqual(weight_feature, options.weight_feature)
      self.assertEqual(sample_rate, options.sample_rate)
      self.assertEqual(num_top_values, options.num_top_values)
      self.assertEqual(frequency_threshold, options.frequency_threshold)
      self.assertEqual(
          weighted_frequency_threshold,
          options.weighted_frequency_threshold,
      )
      self.assertEqual(
          num_rank_histogram_buckets, options.num_rank_histogram_buckets
      )
      self.assertEqual(
          num_values_histogram_buckets,
          options.num_values_histogram_buckets,
      )
      self.assertEqual(
          num_histogram_buckets, options.num_histogram_buckets
      )
      self.assertEqual(
          num_quantiles_histogram_buckets,
          options.num_quantiles_histogram_buckets,
      )
      self.assertEqual(epsilon, options.epsilon)
      self.assertEqual(
          infer_type_from_schema, options.infer_type_from_schema
      )
      self.assertEqual(desired_batch_size, options.desired_batch_size)
      self.assertEqual(
          enable_semantic_domain_stats,
          options.enable_semantic_domain_stats,
      )
      self.assertEqual(
          semantic_domain_stats_sample_rate,
          options.semantic_domain_stats_sample_rate,
      )
      self.assertEqual(
          per_feature_weight_override,
          options._per_feature_weight_override,
      )
      self.assertEqual(
          add_default_generators, options.add_default_generators
      )
      self.assertEqual(
          use_sketch_based_topk_uniques,
          options.use_sketch_based_topk_uniques,
      )
      self.assertEqual(
          experimental_result_partitions,
          options.experimental_result_partitions,
      )
      self.assertEqual(slicing_config, options.slicing_config)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  from typing import Optional
  import unittest
  from absl.testing import absltest
  from absl.testing import parameterized
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.statistics.generators import lift_stats_generator
  from tensorflow_data_validation.utils import slicing_util
  from tfx_bsl.public.proto import slicing_spec_pb2
  from google.protobuf import text_format
  from tensorflow.python.util.protobuf import compare
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 3 for calling the StatsOptionsTest obj's underlying member method code with example usage: obj.test_valid_stats_options_json_round_trip() without return types