我想将一些数据拆分为3折,但不要分离具有相同ID的图元。
x=[2,4,5,3,5,6,7,8,8,3,5,2,6,7,8,4]
y=["a","b","c","a","d","f","c","a","a","d","v","f","a","d","r","h"]
groups=[1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]
我尝试了下一个代码,但是在这一行中,我将各组分开:
folds_x=np.array_split(x, 3)
folds_y=np.array_split(y, 3)
我尝试了下一条命令,但是我只想创建10折而不是每次K-1折:
generator = GroupKFold(n_splits=10).split(x, y, groups)
for train_index,test_index in generator:
print(len(train_index))
我该怎么做?