pyntbci.transformers.Vectorizer
- class pyntbci.transformers.Vectorizer(channel_prime: bool = False)[source]
Vectorizer. Flattens a multi-dimensional data matrix per trial into a single feature vector, e.g. to use multi-channel time-series data with generic (non multi-dimensional) scikit-learn estimators.
- Parameters:
channel_prime (bool (default: False)) – Whether the channels are the fastest-varying (i.e., contiguous) dimension in the flattened feature vector. If False, the samples are the fastest-varying dimension instead.
- fit(X: NDArray, y: NDArray = None) TransformerMixin[source]
Fit the vectorizer. Note, does not involve learning.
- Parameters:
X (NDArray) – Data matrix of shape (n_trials, n_channels, n_samples).
y (NDArray (default: None)) – Not used.
- Returns:
self – Returns the instance itself.
- Return type:
TransformerMixin
- transform(X: NDArray, y: NDArray = None) NDArray[source]
Flatten the data matrix per trial into a single feature vector.
- Parameters:
X (NDArray) – Data matrix of shape (n_trials, n_channels, n_samples).
y (NDArray (default: None)) – Not used.
- Returns:
X – Flattened data matrix of shape (n_trials, n_channels * n_samples).
- Return type:
NDArray