- class braindecode.samplers.BalancedSequenceSampler(metadata, n_windows, n_sequences=10, random_state=None)[source]#
Balanced sampling of sequences of consecutive windows with categorical targets.
Balanced sampling of sequences inspired by the approach of [Perslev2021]: 1. Uniformly sample a recording out of the available ones. 2. Uniformly sample one of the classes. 3. Sample a window of the corresponding class in the selected recording. 4. Extract a sequence of windows around the sampled window.
Perslev M, Darkner S, Kempfner L, Nikolic M, Jennum PJ, Igel C. U-Sleep: resilient high-frequency sleep staging. npj Digit. Med. 4, 72 (2021). perslev/U-Time