话不多说,用例子说话:
from sklearn.model_selection import KFold kf = KFold(n_splits=5, random_state=43, shuffle=True) a=[[1,2],[3,4],[5,6],[7,8],[9,10]] b=[1,2,3,4,5] for i,j in kf.split(a,b): print(i,j) #输出: [0 1 2 4] [3] [0 1 3 4] [2] [0 2 3 4] [1] [1 2 3 4] [0] [0 1 2 3] [4]
不用多说了吧,上面的数都是索引,其实就是从0-4索引里,选一个作为输出,其他都是输入。
标签:输出,selection,kf,KFold,类似,索引,split From: https://www.cnblogs.com/Li-JT/p/16791405.html