出现TypeError: ‘KFold’ object is not iterable错误

其实是旧库和新库的冲突,将迭代的对象变一下就好了,比如

kf = KFold(titanic.shape[0], n_splits=3, random_state=1, shuffle=False)
for train, test in kf:
...

改为

kf = KFold(titanic.shape[0], n_splits=3, random_state=1, shuffle=False)
for train, test in kf.split(titanic):
...

问题解决,错误来自泰坦尼克号的实战:

https://blog.csdn.net/qq_43653405/article/details/107416472

©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页