class_docstr: Options for generating statistics.
class_docstr_tok: ["Options","for","generating","statistics","."]
code: def sample_rate(self, sample_rate: Optional[float]):
      if sample_rate is not None:
          if not 0 < sample_rate <= 1:
              raise ValueError("Invalid sample_rate %f" % sample_rate)
      self._sample_rate = sample_rate
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import json
  import logging
  import types
  from typing import Dict, List, Optional, Text, Union
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import example_weight_map
  from tensorflow_data_validation.utils import schema_util
  from tensorflow_data_validation.utils import slicing_util
  from tfx_bsl.arrow import sql_util
  from tfx_bsl.coders import example_coder
  from tfx_bsl.public.proto import slicing_spec_pb2
  from google.protobuf import json_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 20 for calling the StatsOptions obj's underlying member method code with example usage: obj.sample_rate(sample_rate) without return types