transformer.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:decoding_challenge_cortana_2016_3rd 作者: kingjr 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号