MCPcopy Create free account
hub / github.com/google/adk-samples / _print_decision_stats

Function _print_decision_stats

python/agents/invoice-processing/eval/eval.py:1070–1087  ·  view source on GitHub ↗

Print decision accuracy and confusion matrix metrics.

(stats: dict)

Source from the content-addressed store, hash-verified

1068
1069
1070def _print_decision_stats(stats: dict) -> None:
1071 """Print decision accuracy and confusion matrix metrics."""
1072 print(f"\n DECISION ACCURACY: {stats['decision_accuracy']:.1%}")
1073 dm = stats["decision_matrix"]
1074 print(f" TP={dm['TP']} FP={dm['FP']} FN={dm['FN']} TN={dm['TN']}")
1075 if dm["TP"] + dm["FP"] > 0:
1076 precision = dm["TP"] / (dm["TP"] + dm["FP"])
1077 print(f" Precision: {precision:.3f}")
1078 if dm["TP"] + dm["FN"] > 0:
1079 recall = dm["TP"] / (dm["TP"] + dm["FN"])
1080 print(f" Recall: {recall:.3f}")
1081 if dm["TP"] + dm["FP"] > 0 and dm["TP"] + dm["FN"] > 0:
1082 f1 = (
1083 2 * precision * recall / (precision + recall)
1084 if (precision + recall) > 0
1085 else 0
1086 )
1087 print(f" F1 Score: {f1:.3f}")
1088
1089
1090def _print_group_and_field_accuracy(stats: dict) -> None:

Callers 1

print_reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected