precision recall f1-score support 0 0.92 0.92 0.92 10762 1 0.85 0.92 0.89 9339 2 0.86 0.45 0.59 1628 micro avg 0.88 0.88 0.88 21729 macro avg 0.88 0.76 0.80 21729 weighted avg 0.88 0.88 0.88 21729 samples avg 0.88 0.88 0.88 21729是reportsreports_dict = [] for report in reports: lines = report.strip().split('\n') classifier_name = lines[0].strip() data = {} for line in lines[2:]: category, precision, recall, f1_score, support = line.strip().split()中for line in lines[2:]: category, precision, recall, f1_score, support = line.strip().split()出现oo many values to unpack (expected 5) on line weighted avg 0.88 0.88 0.88 21729 Error: too many values to unpack (expected 5) on line samples avg 0.88 0.88 0.88 21729怎么修正
时间: 2024-03-02 17:50:23 浏览: 80
acc.m.zip_ACC图像分割_F1-score_Score!_acc.m_图像召回率
5星 · 资源好评率100%
可以将代码修改为以下形式,使用 *args 解包任意数量的参数,并将前4个参数赋值给相应的变量,最后一个参数用于支持度的计数,可以忽略。
```
for line in lines[2:]:
category, *scores, support = line.strip().split()
precision, recall, f1_score = map(float, scores)
```
这样就能够正确地解包出前4个参数并将其赋值给相应的变量了。
阅读全文