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

Function calculate_overall_score

RealChart2Code_eval/evaluate_task3.py:651–695  ·  view source on GitHub ↗
(evaluation: Dict)

Source from the content-addressed store, hash-verified

649 }
650
651def calculate_overall_score(evaluation: Dict) -> Dict:
652 # Visual Structure Alignment scores (0-1 scale)
653 visual_structure = evaluation.get('visual_structure_alignment', {})
654 visual_structure_scores = {
655 'chart_type_consistency': visual_structure.get('chart_type_consistency', {}).get('score', 0),
656 'spatial_layout_consistency': visual_structure.get('spatial_layout_consistency', {}).get('score', 0),
657 'text_element_consistency': visual_structure.get('text_element_consistency', {}).get('score', 0),
658 'axis_configuration_consistency': visual_structure.get('axis_configuration_consistency', {}).get('score', 0),
659 'color_scheme_consistency': visual_structure.get('color_scheme_consistency', {}).get('score', 0),
660 'style_and_format_consistency': visual_structure.get('style_and_format_consistency', {}).get('score', 0),
661 'component_completeness': visual_structure.get('component_completeness', {}).get('score', 0)
662 }
663
664 # Execution Quality scores (0-2 scale)
665 execution_quality = evaluation.get('execution_quality', {})
666 execution_scores = {
667 'visual_clarity': execution_quality.get('visual_clarity', {}).get('score', 0),
668 'compositional_balance': execution_quality.get('compositional_balance', {}).get('score', 0),
669 'data_integrity': execution_quality.get('data_integrity', {}).get('score', 0)
670 }
671
672 # Calculate totals
673 visual_structure_total = sum(visual_structure_scores.values())
674 execution_total = sum(execution_scores.values())
675
676 # Overall scoring
677 total_possible_visual_structure = len(visual_structure_scores) * 2 # 16 points max (0-2 scale)
678 total_possible_execution = len(execution_scores) * 2 # 6 points max (0-2 scale)
679
680 total_score = visual_structure_total + execution_total
681 total_possible = total_possible_visual_structure + total_possible_execution
682
683 return {
684 'visual_structure_scores': visual_structure_scores,
685 'execution_quality_scores': execution_scores,
686 'visual_structure_total': visual_structure_total,
687 'visual_structure_max': total_possible_visual_structure,
688 'execution_quality_total': execution_total,
689 'execution_quality_max': total_possible_execution,
690 'overall_total_score': total_score,
691 'overall_max_score': total_possible,
692 'visual_structure_rate': visual_structure_total / total_possible_visual_structure if total_possible_visual_structure > 0 else 0,
693 'execution_quality_avg': execution_total / len(execution_scores) if execution_scores else 0,
694 'overall_percentage': total_score / total_possible if total_possible > 0 else 0
695 }
696
697
698def save_score_result(task_info: Dict, evaluation: Dict, raw_response: str, plot_file: Path,

Callers 1

save_score_resultFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected