概述
这是代码:
kFold = KFold(n_splits=10,shuffle=True,random_state=None) for train_index,test_index in kFold.split(dfNARemove):...
我得到了一些在我的df中不存在的train_index或test_index.
我能做什么?
kFold = KFold(n_splits=10,test_index in kFold.split(dfNARemove): train_data = dfNARemove.iloc[train_index] test_data = dfNARemove.iloc[test_index]
如果您想知道每个折叠上用于train_index和test_index的非连续索引,您可以执行以下操作:
non_continuous_train_index = dfNARemove.index[train_index] non_continuous_test_index = dfNARemove.index[test_index]
总结
以上是编程之家为你收集整理的sklearn kfold在python中返回错误的索引全部内容,希望文章能够帮你解决sklearn kfold在python中返回错误的索引所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧