(results_dir: Path, generation_model: str, evaluation_model: str)
| 940 | |
| 941 | |
| 942 | def generate_statistics(results_dir: Path, generation_model: str, evaluation_model: str) -> Dict: |
| 943 | |
| 944 | |
| 945 | score_files = list(results_dir.glob("**/score_*.json")) |
| 946 | |
| 947 | if not score_files: |
| 948 | return {} |
| 949 | |
| 950 | all_scores = [] |
| 951 | stats_by_difficulty = {} |
| 952 | stats_by_category = {} |
| 953 | |
| 954 | |
| 955 | execution_stats = { |
| 956 | 'total_tasks': 0, |
| 957 | 'code_generated': 0, |
| 958 | 'code_executed': 0, |
| 959 | 'plot_generated': 0, |
| 960 | 'evaluation_completed': 0 |
| 961 | } |
| 962 | |
| 963 | |
| 964 | for score_file in score_files: |
| 965 | with open(score_file, 'r', encoding='utf-8') as f: |
| 966 | score = json.load(f) |
| 967 | |
| 968 | difficulty = score['difficulty'] |
| 969 | category = score['category'] |
| 970 | is_multi = score['is_multi'] |
| 971 | |
| 972 | |
| 973 | execution_stats['total_tasks'] += 1 |
| 974 | if score.get('code_generated', False): |
| 975 | execution_stats['code_generated'] += 1 |
| 976 | if score.get('execution_success', False): |
| 977 | execution_stats['code_executed'] += 1 |
| 978 | if score.get('plot_generated', False): |
| 979 | execution_stats['plot_generated'] += 1 |
| 980 | if score.get('plot_generated', False): |
| 981 | execution_stats['evaluation_completed'] += 1 |
| 982 | |
| 983 | |
| 984 | overall_score = score.get('overall_score') |
| 985 | if overall_score: |
| 986 | score_data = { |
| 987 | 'visual_structure_total': overall_score['visual_structure_total'], |
| 988 | 'visual_structure_max': overall_score['visual_structure_max'], |
| 989 | 'execution_quality_total': overall_score['execution_quality_total'], |
| 990 | 'execution_quality_max': overall_score['execution_quality_max'], |
| 991 | 'overall_total_score': overall_score['overall_total_score'], |
| 992 | 'overall_max_score': overall_score['overall_max_score'], |
| 993 | 'visual_structure_rate': overall_score['visual_structure_rate'], |
| 994 | 'execution_quality_avg': overall_score['execution_quality_avg'], |
| 995 | 'overall_percentage': overall_score['overall_percentage'], |
| 996 | 'difficulty': difficulty, |
| 997 | 'category': category, |
| 998 | 'is_multi': is_multi, |
| 999 | 'execution_success': score.get('execution_success', False), |
no test coverage detected