RandomFixedWindowSampler#
- class torch_brain.data.sampler.RandomFixedWindowSampler(*, sampling_intervals, window_length, generator=None, drop_short=True)[source]#
Bases:
torch.utils.data.sampler.SamplerSamples fixed-length windows randomly, given intervals defined in the
sampling_intervalsparameter.sampling_intervalsis a dictionary where the keys are the session ids and the values are lists of tuples representing the start and end of the intervals from which to sample. The samples are shuffled, and random temporal jitter is applied.In one epoch, the number of samples that is generated from a given sampling interval is given by:
\[N = \left\lfloor\frac{\text{interval_length}}{\text{window_length}}\right\rfloor\]- Parameters:
sampling_intervals (Dict[str, List[Tuple[int, int]]]) – Sampling intervals for each session in the dataset.
window_length (float) – Length of the window to sample.
generator (Optional[torch.Generator], optional) – Generator for shuffling. Defaults to None.
drop_short (bool, optional) – Whether to drop short intervals. Defaults to True.