class_docstr: A map-to-arrays dict, with deterministic Reservoir Sampling.
  
  Store each reservoir bucket by key, and each bucket is a list sampling
  with reservoir algorithm.
docstr: Creates a new reservoir.
  
  Args:
      max_size: The number of values to keep in the reservoir for each tag,
          if max_size is zero, all values will be kept in bucket.
      seed: The seed to initialize a random.Random().
      num_item_index: The index of data to add.
  
  Raises:
    ValueError: If max_size is not a nonnegative integer.
docstr_tok: ["Creates","a","new","reservoir",".","Args",":","max_size",":","The","number","of","values","to","keep","in","the","reservoir","for","each","tag",",","if","max_size","is","zero",",","all","values","will","be","kept","in","bucket",".","seed",":","The","seed","to","initialize","a","random.Random","(",")",".","num_item_index",":","The","index","of","data","to","add",".","Raises",":","ValueError",":","If","max_size","is","not","a","nonnegative","integer","."]
code: def __init__(self, max_size, seed=0):
      """Creates a new reservoir.
  
      Args:
          max_size: The number of values to keep in the reservoir for each tag,
              if max_size is zero, all values will be kept in bucket.
          seed: The seed to initialize a random.Random().
          num_item_index: The index of data to add.
  
      Raises:
        ValueError: If max_size is not a nonnegative integer.
      """
      if max_size < 0 or max_size != round(max_size):
          raise ValueError("Max_size must be nonnegative integer.")
      self._max_size = max_size
      self._buckets = collections.defaultdict(
          lambda: _ReservoirBucket(
              max_size=self._max_size,
              random_instance=random.Random(seed),
          )
      )
      self._mutex = threading.Lock()
  
imports: import collections
  import random
  import threading
label_desc: Use image node_id 1 to create a new Reservoir object from inherited base classes: object with example: obj = Reservoir(max_size, seed)