hmm_sparsity.py 文件源码

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

项目:nelpy 作者: nelpy 项目源码 文件源码
def _preprocess_PBEs(self, PBE_idx=None):
        """used for most types of shuffles"""
        # compute PBEs
        self.PBEs = self._st.bin(ds=self._ds)

        if self.PBEs.n_epochs == 1:
            raise ValueError("spike train is continuous, and does not have more than one event!")

        if PBE_idx is not None:
            self._trainidx, self._testidx = PBE_idx # tuple unpacking
        else:
            # split into train and test data
            if self._random_state is not None:
                self._trainidx, self._testidx = train_test_split(np.arange(self.PBEs.n_epochs), test_size=self._test_size, random_state=self._random_state)
            else:
                self._trainidx, self._testidx = train_test_split(np.arange(self.PBEs.n_epochs), test_size=self._test_size, random_state=1)

        self._trainidx.sort()
        self._testidx.sort()

        self.PBEs_train = self.PBEs[self._trainidx]
        self.PBEs_test = self.PBEs[self._testidx]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号