【发布时间】:2020-07-19 14:56:48
【问题描述】:
我正在尝试使用 KFold 在数据集上训练机器学习模型。我不断收到这个关键错误,不知道如何解决。 我已经尝试过中提到的方法 How To Solve KeyError: u"None of [Index([..], dtype='object')] are in the [columns]" 这是我的代码
diffFile = pd.read_csv('Difference.csv', delimiter=',', delim_whitespace= 0)
X = diffFile.iloc[:,[0,1,2]]
y = diffFile.iloc[:,3]
adb = AdaBoostClassifier()
scores = []
kf = KFold(n_splits=30)
for train_index,test_index in kf.split(X):
X_train,X_test=X[train_index],X[test_index]
y_train,y_test=y[train_index],y[test_index]
adb.fit(X_train,y_train)
scores.append(adb.score(X_test,y_test))
这是我的文件 https://drive.google.com/file/d/1_VwBNSADq6l893VFiULVPzrBYiB-fqyo/view?usp=sharing
我正在使用带有 Python 3.7 的 Jupyter Notebook 任何帮助将非常感激。 谢谢你
【问题讨论】:
-
你的问题是什么?