avalanche.training.ExperienceBalancedBuffer
- class avalanche.training.ExperienceBalancedBuffer(max_size: int, adaptive_size: bool = True, num_experiences=None)[source]
Rehearsal buffer with samples balanced over experiences.
The number of experiences can be fixed up front or adaptive, based on the ‘adaptive_size’ attribute. When adaptive, the memory is equally divided over all the unique observed experiences so far.
- __init__(max_size: int, adaptive_size: bool = True, num_experiences=None)[source]
- Parameters:
max_size – max number of total input samples in the replay memory.
adaptive_size – True if mem_size is divided equally over all observed experiences (keys in replay_mem).
num_experiences – If adaptive size is False, the fixed number of experiences to divide capacity over.
Methods
__init__
(max_size[, adaptive_size, ...])- param max_size:
max number of total input samples in the replay
get_group_lengths
(num_groups)Compute groups lengths given the number of groups num_groups.
post_adapt
(agent, exp)Update self.buffer using the agent state and current experience.
resize
(strategy, new_size)Update the maximum size of the buffers.
update
(strategy, **kwargs)Update self.buffer using the strategy state.
Attributes
buffer
Buffer of samples.
buffer_datasets
Return group buffers as a list of `AvalancheDataset`s.
buffer_groups
Dictionary of buffers.
max_size
Maximum size of the buffer.