class_docstr: This is the proportional sampling variant of the prioritized experience replay as described
  in https://arxiv.org/pdf/1511.05952.pdf.
docstr: :param max_size: the maximum number of transitions or episodes to hold in the memory
  :param alpha: the alpha prioritization coefficient
  :param beta: the beta parameter used for importance sampling
  :param epsilon: a small value added to the priority of each transition
  :param allow_duplicates_in_batch_sampling: allow having the same transition multiple times in a batch
docstr_tok: [":","param","max_size",":","the","maximum","number","of","transitions","or","episodes","to","hold","in","the","memory",":","param","alpha",":","the","alpha","prioritization","coefficient",":","param","beta",":","the","beta","parameter","used","for","importance","sampling",":","param","epsilon",":","a","small","value","added","to","the","priority","of","each","transition",":","param","allow_duplicates_in_batch_sampling",":","allow","having","the","same","transition","multiple","times","in","a","batch"]
code: def __init__(
      self,
      max_size: Tuple[MemoryGranularity, int],
      alpha: float = 0.6,
      beta: Schedule = ConstantSchedule(0.4),
      epsilon: float = 1e-6,
      allow_duplicates_in_batch_sampling: bool = True,
  ):
      """
      :param max_size: the maximum number of transitions or episodes to hold in the memory
      :param alpha: the alpha prioritization coefficient
      :param beta: the beta parameter used for importance sampling
      :param epsilon: a small value added to the priority of each transition
      :param allow_duplicates_in_batch_sampling: allow having the same transition multiple times in a batch
      """
      if max_size[0] != MemoryGranularity.Transitions:
          raise ValueError(
              "Prioritized Experience Replay currently only support setting the memory size in "
              "transitions granularity."
          )
      self.power_of_2_size = 1
      while self.power_of_2_size < max_size[1]:
          self.power_of_2_size *= 2
      super().__init__(
          (MemoryGranularity.Transitions, self.power_of_2_size),
          allow_duplicates_in_batch_sampling,
      )
      self.sum_tree = SegmentTree(
          self.power_of_2_size, SegmentTree.Operation.SUM
      )
      self.min_tree = SegmentTree(
          self.power_of_2_size, SegmentTree.Operation.MIN
      )
      self.max_tree = SegmentTree(
          self.power_of_2_size, SegmentTree.Operation.MAX
      )
      self.alpha = alpha
      self.beta = beta
      self.epsilon = epsilon
      self.maximal_priority = 1.0
  
imports: import operator
  import random
  from enum import Enum
  from typing import List, Tuple, Any
  import numpy
  from rl_coach.core_types import Transition
  from rl_coach.memories.memory import MemoryGranularity
  from rl_coach.memories.non_episodic.experience_replay import ExperienceReplayParameters, ExperienceReplay
  from rl_coach.schedules import Schedule, ConstantSchedule
label_desc: Use image node_id 1 to create a new PrioritizedExperienceReplay object from inherited base classes: ExperienceReplay with example: obj = PrioritizedExperienceReplay(max_size, alpha, beta, epsilon, allow_duplicates_in_batch_sampling)