braindecode.datasets.create_from_X_y#

braindecode.datasets.create_from_X_y(X, y, drop_last_window, sfreq, ch_names=None, window_size_samples=None, window_stride_samples=None)[source]#

Create a BaseConcatDataset of WindowsDatasets from X and y to be used for decoding with skorch and braindecode, where X is a list of pre-cut trials and y are corresponding targets.

Parameters:
  • X (array-like) – list of pre-cut trials as n_trials x n_channels x n_times

  • y (array-like) – targets corresponding to the trials

  • drop_last_window (bool) – whether or not have a last overlapping window, when windows/windows do not equally divide the continuous signal

  • sfreq (float) – Sampling frequency of signals.

  • ch_names (array-like) – Names of the channels.

  • window_size_samples (int) – window size

  • window_stride_samples (int) – stride between windows

Returns:

windows_datasets – X and y transformed to a dataset format that is compatible with skorch and braindecode

Return type:

BaseConcatDataset

Examples using braindecode.datasets.create_from_X_y#

Custom Dataset Example

Custom Dataset Example