- class avalanche.training.ClassBalancedBuffer(max_size: int, adaptive_size: bool = True, total_num_classes: int | None = None)
Stores samples for replay, equally divided over classes.
There is a separate buffer updated by reservoir sampling for each class. 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: int | None = 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, ...])
Compute groups lengths given the number of groups num_groups.
Update the maximum size of the buffers.
Buffer of samples.
Return group buffers as a list of `AvalancheDataset`s.
Dictionary of buffers.
Maximum size of the buffer.