code: def test_convergence(self):
      size = 100
  
      buf = prioritized.PrioritizedBuffer(capacity=size)
      for x in range(size):
          buf.append(x)
  
      priority_init = list([(i + 1) / size for i in range(size)])
      random.shuffle(priority_init)
      count_sampled = [0] * size
  
      def priority(x, n):
          if n == 0:
              return 1.0
          else:
              return priority_init[x] / count_sampled[x]
  
      for _ in range(200):
          sampled, probabilities, _ = buf.sample(
              16, uniform_ratio=self.uniform_ratio
          )
          priority_old = [
              priority(x, count_sampled[x]) for x in sampled
          ]
          if self.uniform_ratio == 0:
              # assert: probabilities \propto priority_old
              qs = [x / y for x, y in zip(probabilities, priority_old)]
              for q in qs:
                  self.assertAlmostEqual(q, qs[0])
          elif self.uniform_ratio == 1:
              # assert: uniform
              for p in probabilities:
                  self.assertAlmostEqual(p, probabilities[0])
          for x in sampled:
              count_sampled[x] += 1
          priority_new = [
              priority(x, count_sampled[x]) for x in sampled
          ]
          buf.set_last_priority(priority_new)
  
      for cnt in count_sampled:
          self.assertGreaterEqual(cnt, 1)
  
      corr = np.corrcoef(np.array([priority_init, count_sampled]))[0, 1]
      corr_lb, corr_ub = self.expected_corr_range
      self.assertGreater(corr, corr_lb)
      self.assertLess(corr, corr_ub)
  
file_path: chainerrl/tests/misc_tests/test_prioritized.py
imports: import unittest
  import numpy
  import random
  from chainer import testing
  from chainer.testing import condition
  from chainerrl.misc import prioritized
label_desc: Use image node_id 1 for calling the TestPrioritizedBuffer obj's underlying member method code with example usage: obj.test_convergence() and returns: int, unknown