braindecode.datasets.create_from_X_y#

braindecode.datasets.create_from_X_y(X: ndarray[Any, dtype[_ScalarType_co]], y: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], drop_last_window: bool, sfreq: float, ch_names: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, window_size_samples: int | None = None, window_stride_samples: int | None = None) BaseConcatDataset[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