experanto.utils.SessionBatchSampler
- class SessionBatchSampler(*args, **kwargs)[source]
Bases:
SamplerA batch sampler that cycles through sessions, ensuring each session appears exactly once before repeating any session.
Methods
__init__(dataset, batch_size[, drop_last, ...])Initialize session batch sampler.
Generate one cycle of sessions, with each session appearing exactly once.
Return the state of the sampler (including RNG state).
set_state(state)Restore the state of the sampler (including RNG state).
- __init__(dataset, batch_size, drop_last=False, shuffle=False, seed=None)[source]
Initialize session batch sampler.
- Parameters:
dataset (SessionConcatDataset) – The dataset to sample from.
batch_size (int) – Number of samples per batch.
drop_last (bool, optional) – Whether to drop the last batch if smaller than batch_size. Default is False.
shuffle (bool, optional) – Whether to shuffle samples within each session. Default is False.
seed (int, optional) – Random seed for reproducibility.