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]
评论列表
文章目录