Class PrioritizedReplayBuffer<T>
- Namespace
- AiDotNet.ReinforcementLearning.ReplayBuffers
- Assembly
- AiDotNet.dll
Prioritized experience replay buffer for reinforcement learning.
public class PrioritizedReplayBuffer<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
PrioritizedReplayBuffer<T>
- Inherited Members
Remarks
Prioritized replay samples important experiences more frequently based on TD error. Uses sum tree data structure for efficient sampling.
Constructors
PrioritizedReplayBuffer(int)
public PrioritizedReplayBuffer(int capacity)
Parameters
capacityint
Properties
Count
public int Count { get; }
Property Value
Methods
Add(Vector<T>, Vector<T>, T, Vector<T>, bool)
public void Add(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done)
Parameters
stateVector<T>actionVector<T>rewardTnextStateVector<T>donebool
Sample(int, double, double)
public (List<(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done)> batch, List<int> indices, List<double> weights) Sample(int batchSize, double alpha, double beta)
Parameters
Returns
- (List<(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done)> batch, List<int> indices, List<double> weights)
UpdatePriorities(List<int>, List<double>, double)
public void UpdatePriorities(List<int> indices, List<double> priorities, double epsilon)