SlideWinAug#
- class dpeeg.transforms.SlideWinAug(win: int, overlap: int = 0, tmin: int = 0, tmax: int | None = None)[source]#
Sliding window data augmentation.
Data augmentation based on sliding windows will apply sliding windows to the training set and crop the corresponding time windows in the test set. By default, augmentation is performed on edata and label. Ensure the availability of the data.
- Parameters:
win (int) – The size of the sliding window.
overlap (int) – The amount of overlap between adjacent sliding windows.
tmin (int) – Start time of selection in sampling points.
tmax (int, optional) – End time of selection in sampling points. The default is to use the window length from the start time.
- Returns:
data – Transformed eegdata.
- Return type:
eegdata or dataset
Notes
Data augmentation is only applied to the edata and label within the eegdata, with other values remaining unchanged. If there are derived values based on the edata, attention should be paid to the order of transformations.
Examples
>>> eegdata = dpeeg.EEGData(edata=np.random.randn(16, 3, 10), ... label=np.random.randint(0, 3, 16)) >>> split_eegdata = dpeeg.SplitEEGData(eegdata.copy(), eegdata.copy()) >>> transforms.SlideWinAug(2)(split_eegdata, verbose=False) Train: [edata=(80, 3, 2), label=(80,)] Test : [edata=(16, 3, 2), label=(16,)]