pyntbci.utilities.encoding_matrix
- pyntbci.utilities.encoding_matrix(stimulus: array, length: int | list[int], stride: int = 1, amplitude: ndarray[Any, dtype[_ScalarType_co]] | None = None) ndarray[Any, dtype[_ScalarType_co]] [source]
Make a Toeplitz-like encoding matrix. Used to phase-shift the stimulus (forward / encoding model), per event to learn a (or several) temporal filter(s). Also called a “structure matrix” or “design matrix”.
- Parameters:
stimulus (NDArray) – Stimulus matrix of shape (n_classes, n_events, n_samples).
length (int | list[int]) – The length in samples of the temporal filter, i.e., the number of phase-shifted stimulus per event. If a list is provided, it denotes the length per event.
stride (int (default: 1)) – The step size in samples over the length of the temporal filter.
amplitude (NDArray (default: None)) – Amplitude information to embed in the encoding matrix of shape (n_classes, n_samples). If None, it is ignored.
- Returns:
ematrix – Encoding matrix of shape (n_classes, n_events * length / stride, n_samples).
- Return type:
NDArray