我正在使用多种评分方法来处理 cross_validate。该results变量是一个字典列表。我正在尝试使用不同模型访问 F1 分数,results['test_f1_score']但我得到了TypeError: list indices must be integers or slices, not tuple. 从列表中获取 F1 分数的最佳方法是什么?
这是从 results 变量生成的列表:
[{'fit_time': array([3.25437379, 3.31360006, 4.55807948, 4.13171291, 4.19844866,
5.00323677, 4.02107215, 4.18458176, 4.82133555, 4.25998092,
3.76690507, 3.97073889, 4.82378697, 4.32887745, 4.66021585,
4.54414296, 5.0830574 , 4.85126257, 5.40511918, 5.04520845,
5.11681008, 4.93635201, 4.74664378, 5.08661175, 4.32240748,
4.10375977, 4.31480002, 4.04965734, 3.78688979, 3.88911653]),
'score_time': array([0.14319539, 0.12677526, 0.10101032, 0.09385777, 0.06942415,
0.11760497, 0.06548786, 0.05601525, 0.07890821, 0.07988477,
0.06272411, 0.07337427, 0.07825518, 0.04193068, 0.04330111,
0.04155302, 0.05201483, 0.0699327 , 0.05248165, 0.04978824,
0.05156302, 0.05214596, 0.07210374, 0.06283927, 0.04857302,
0.05679178, 0.04323983, 0.04890585, 0.04407573, 0.05073118]),
'test_f1_score': array([0.03381643, 0.06428571, 0.01939058, 0.02870813, 0.05673759,
0.05128205, 0.06306306, 0.01066667, 0.08275862, 0.0180791 ,
0.03755869, 0.04013378, 0.04255319, 0.07619048, 0.04494382,
0.0818118, 0.02181818, 0.02171291, 0.03367003, 0.04195804,
0.01532567, 0.05687204, 0.0591716 , 0.05825243, 0.07659574,
0.04848485, 0.01724138, 0.02247191, 0.01233046, 0.01920439]),
'test_f05_measure': array([0.02168525, 0.04174397, 0.01229796, 0.01840491, 0.03683241,
0.03355705, 0.04137116, 0.00676133, 0.05576208, 0.01143511,
0.02386635, 0.02599653, 0.02873563, 0.05012531, 0.02985075,
0.05369928, 0.01390176, 0.01374465, 0.02181501, 0.02722323,
0.00967586, 0.03740648, 0.03816794, 0.03836317, 0.05011136,
0.0312989 , 0.01089918, 0.01447178, 0.00780762, 0.01217815]),
'test_sensitivity': array([0.5 , 0.64285714, 0.5 , 0.42857143, 0.57142857,
炎炎设计
茅侃侃
相关分类