braindecode.datasets.WindowsDataset#

class braindecode.datasets.WindowsDataset(windows: BaseEpochs, description: dict | Series | None = None, transform: Callable | None = None, targets_from: str = 'metadata', last_target_only: bool = True)[source]#

Returns windows from an mne.Epochs object along with a target.

Dataset which serves windows from an mne.Epochs object along with their target and additional information. The metadata attribute of the Epochs object must contain a column called target, which will be used to return the target that corresponds to a window. Additional columns i_window_in_trial, i_start_in_trial, i_stop_in_trial are also required to serve information about the windowing (e.g., useful for cropped training). See braindecode.datautil.windowers to directly create a WindowsDataset from a BaseDataset object.

Parameters:
  • windows (mne.Epochs) – Windows obtained through the application of a windower to a BaseDataset (see braindecode.datautil.windowers).

  • description (dict | pandas.Series | None) – Holds additional info about the windows.

  • transform (callable | None) – On-the-fly transform applied to a window before it is returned.

  • targets_from (str) – Defines whether targets will be extracted from mne.Epochs metadata or mne.Epochs misc channels (time series targets). It can be metadata (default) or channels.

Methods

set_description(description: dict | Series, overwrite: bool = False)[source]#

Update (add or overwrite) the dataset description.

Parameters:
  • description (dict | pd.Series) – Description in the form key: value.

  • overwrite (bool) – Has to be True if a key in description already exists in the dataset description.