我在Train_score中出错,但在test_score中却没有错误,我该如何解决这个问题:
MLA_compare.loc[row_index, 'MLA Time'] = cv_results['fit_time'].mean()
MLA_compare.loc[row_index, 'MLA Train Accuracy Mean'] = cv_results['train_score'].mean()
MLA_compare.loc[row_index, 'MLA Test Accuracy Mean'] = cv_results['test_score'].mean()
KeyError:'train_score'
答案 0 :(得分:0)
您必须将条件添加到行中
cv_results = model_selection.cross_validate( alg, data1[data1_x_bin],
data1[Target], cv=cv_split, return_train_score=True )