docstr: Tests observed frequency is close to expected frequency.
docstr_tok: ["Tests","observed","frequency","is","close","to","expected","frequency","."]
code: def test_reservoir_sample_frequency(self, iterable_size, k):
      """Tests observed frequency is close to expected frequency."""
      # Use a fixed random number so our test is deterministic.
      random = np.random.RandomState(123456789)
      n_replicates = 100000
      counts = collections.Counter(
          item
          for _ in range(n_replicates)
          for item in utils.reservoir_sample(
              range(iterable_size), k, random
          )
      )
      expected_frequency = min(k / float(iterable_size), 1.0)
      for c in counts.values():
          observed_frequency = c / float(n_replicates)
          npt.assert_allclose(
              observed_frequency, expected_frequency, atol=0.01
          )
  
file_path: deepvariant/third_party/nucleus/util/utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import numpy.testing
  from third_party.nucleus.testing import test_utils
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import utils
label_desc: Use image node_id 4 for calling the UtilsTest obj's underlying member method code with example usage: obj.test_reservoir_sample_frequency(iterable_size, k) without return types