MCPcopy Create free account
hub / github.com/Speakn0w/RealChart2Code / calc_stats

Function calc_stats

RealChart2Code_eval/evaluate_task2.py:1063–1093  ·  view source on GitHub ↗
(scores)

Source from the content-addressed store, hash-verified

1061
1062
1063 def calc_stats(scores):
1064 if not scores:
1065 return {}
1066
1067 visual_structure_scores = [s['visual_structure_total'] for s in scores]
1068 execution_scores = [s['execution_quality_total'] for s in scores]
1069 data_alignment_scores = [s['data_alignment_total'] for s in scores]
1070 overall_scores = [s['overall_total_score'] for s in scores]
1071
1072 total_count = len(scores)
1073 code_executed_count = sum(1 for s in scores if s.get('execution_success', False))
1074 plot_generated_count = sum(1 for s in scores if s.get('plot_generated', False))
1075
1076 return {
1077 'count': total_count,
1078 'visual_structure_avg': sum(visual_structure_scores) / len(visual_structure_scores),
1079 'visual_structure_max': scores[0]['visual_structure_max'],
1080 'execution_quality_avg': sum(execution_scores) / len(execution_scores),
1081 'execution_quality_max': scores[0]['execution_quality_max'],
1082 'data_alignment_avg': sum(data_alignment_scores) / len(data_alignment_scores),
1083 'data_alignment_max': scores[0]['data_alignment_max'],
1084 'overall_score_avg': sum(overall_scores) / len(overall_scores),
1085 'overall_max_score': scores[0]['overall_max_score'],
1086 'visual_structure_perfect_rate': sum(1 for s in visual_structure_scores if s == scores[0]['visual_structure_max']) / len(visual_structure_scores),
1087 'execution_quality_perfect_rate': sum(1 for s in execution_scores if s == scores[0]['execution_quality_max']) / len(execution_scores),
1088 'data_alignment_perfect_rate': sum(1 for s in data_alignment_scores if s == scores[0]['data_alignment_max']) / len(data_alignment_scores),
1089 'code_execution_rate': code_executed_count / total_count,
1090 'plot_generation_rate': plot_generated_count / total_count,
1091 'overall_success_rate': plot_generated_count / total_count,
1092 'overall_percentage_avg': sum(s['overall_percentage'] for s in scores) / len(scores) if scores else 0
1093 }
1094
1095 execution_rates = {
1096 'code_generation_rate': execution_stats['code_generated'] / execution_stats['total_tasks'] if execution_stats['total_tasks'] > 0 else 0,

Callers 1

generate_statisticsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected