- class avalanche.training.ClassBalancedBuffer(max_size: int, adaptive_size: bool = True, total_num_classes: Optional[int] = None)
Stores samples for replay, equally divided over classes.
- There is a separate buffer updated by reservoir sampling for each
It should be called in the ‘after_training_exp’ phase (see ExperienceBalancedStoragePolicy). The number of classes 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 classes so far.
- __init__(max_size: int, adaptive_size: bool = True, total_num_classes: Optional[int] = None)
max_size – The max capacity of the replay memory.
adaptive_size – True if mem_size is divided equally over all observed experiences (keys in replay_mem).
total_num_classes – If adaptive size is False, the fixed number of classes to divide capacity over.
__init__(max_size[, adaptive_size, ...])
- param max_size
The max capacity of the replay memory.
Compute groups lengths given the number of groups num_groups.
Update the maximum size of the buffers.
Update self.buffer_groups using the strategy state.
Buffer of samples.
Return group buffers as a list of `AvalancheDataset`s. .