chore: change log template

This commit is contained in:
2024-11-13 17:15:18 +08:00
parent f175eca4d4
commit 44f01802ee
+4 -7
View File
@@ -98,16 +98,13 @@ def evaluate_svm(
if result == test_labels[i] and test_labels[i] != -1: if result == test_labels[i] and test_labels[i] != -1:
correct += 1 correct += 1
else: else:
temp_log_details.append( print(f"第 {i+1} 个数据被分类到 {result},但实际是 {test_labels[i]}")
f"第 {i+1} 次测试错误,数据 {test_data[i]} 被分类到 {result} 实际是 {test_labels[i]}" temp_log_details.append(f"{i+1}")
)
print(
f"第 {i+1} 次测试错误,数据 {test_data[i]} 被分类到 {result} 实际是 {test_labels[i]}"
)
accuracy = correct / total accuracy = correct / total
if accuracy >= LOW_ACCURACY_THRESHOLD: if accuracy >= LOW_ACCURACY_THRESHOLD:
log_details.extend(temp_log_details) log_details.append(f"以下测试次序的数据分类错误:")
log_details.append(", ".join(temp_log_details))
else: else:
log_details.append("分类准确率较低,成绩中不记录错误日志") log_details.append("分类准确率较低,成绩中不记录错误日志")
log_details.append(f"分类准确率: {accuracy * 100:.2f}%") log_details.append(f"分类准确率: {accuracy * 100:.2f}%")