def get_cv(self, X, y):
unique_event_ids = np.unique(y[:, 0])
event_cv = ShuffleSplit(
n_splits=self.n_cv, test_size=self.cv_test_size,
random_state=self.random_state)
for train_event_is, test_event_is in event_cv.split(unique_event_ids):
train_is = np.where(
np.in1d(y[:, 0], unique_event_ids[train_event_is]))[0]
test_is = np.where(
np.in1d(y[:, 0], unique_event_ids[test_event_is]))[0]
yield train_is, test_is
评论列表
文章目录