def transform(self, epochs_data, y=None):
"""For each epoch, concatenate data from different channels into a single
feature vector.
Parameters
----------
epochs_data : array, shape (n_epochs, n_channels, n_times)
The data.
y : None | array, shape (n_epochs,)
The label for each epoch.
If None not used. Defaults to None.
Returns
-------
X : array, shape (n_epochs, n_channels * n_times)
The data concatenated over channels
"""
if not isinstance(epochs_data, np.ndarray):
raise ValueError("epochs_data should be of type ndarray (got %s)."
% type(epochs_data))
epochs_data = np.atleast_3d(epochs_data)
n_epochs, n_channels, n_times = epochs_data.shape
X = epochs_data.reshape(n_epochs, n_channels * n_times)
# save attributes for inverse_transform
self.n_epochs = n_epochs
self.n_channels = n_channels
self.n_times = n_times
return X
transformer.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录