我在train_score中遇到错误,有人可以解决吗?

时间:2019-12-23 09:55:18

标签: python

我在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'

1 个答案:

答案 0 :(得分:0)

您必须将条件添加到行中

cv_results = model_selection.cross_validate( alg, data1[data1_x_bin],
                     data1[Target], cv=cv_split, return_train_score=True )