MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / print_scores

Function print_scores

single_eval.py:451–502  ·  view source on GitHub ↗
(scores, etype, include_turn_acc=True)

Source from the content-addressed store, hash-verified

449
450
451def print_scores(scores, etype, include_turn_acc=True):
452 turns = ['turn 1', 'turn 2', 'turn 3', 'turn 4', 'turn > 4']
453 levels = ['easy', 'medium', 'hard', 'extra', 'all']
454 if include_turn_acc:
455 levels.append('joint_all')
456 partial_types = ['select', 'select(no AGG)', 'where', 'where(no OP)', 'group(no Having)',
457 'group', 'order', 'and/or', 'IUEN', 'keywords']
458
459 print_formated_s("", levels, '{:20}')
460 counts = [scores[level]['count'] for level in levels]
461 print_formated_s("count", counts, '{:<20d}')
462
463 if etype in ["all", "exec"]:
464 print('===================== EXECUTION ACCURACY =====================')
465 exec_scores = [scores[level]['exec'] for level in levels]
466 print_formated_s("execution", exec_scores, '{:<20.3f}')
467
468 if etype in ["all", "match"]:
469 print('\n====================== EXACT MATCHING ACCURACY =====================')
470 exact_scores = [scores[level]['exact'] for level in levels]
471 print_formated_s("exact match", exact_scores, '{:<20.3f}')
472 print('\n---------------------PARTIAL MATCHING ACCURACY----------------------')
473 for type_ in partial_types:
474 this_scores = [scores[level]['partial'][type_]['acc'] for level in levels]
475 print_formated_s(type_, this_scores, '{:<20.3f}')
476
477 print('---------------------- PARTIAL MATCHING RECALL ----------------------')
478 for type_ in partial_types:
479 this_scores = [scores[level]['partial'][type_]['rec'] for level in levels]
480 print_formated_s(type_, this_scores, '{:<20.3f}')
481
482 print('---------------------- PARTIAL MATCHING F1 --------------------------')
483 for type_ in partial_types:
484 this_scores = [scores[level]['partial'][type_]['f1'] for level in levels]
485 print_formated_s(type_, this_scores, '{:<20.3f}')
486
487 if include_turn_acc:
488 print()
489 print()
490 print_formated_s("", turns, '{:20}')
491 counts = [scores[turn]['count'] for turn in turns]
492 print_formated_s("count", counts, "{:<20d}")
493
494 if etype in ["all", "exec"]:
495 print('===================== TURN EXECUTION ACCURACY =====================')
496 exec_scores = [scores[turn]['exec'] for turn in turns]
497 print_formated_s("execution", exec_scores, '{:<20.3f}')
498
499 if etype in ["all", "match"]:
500 print('\n====================== TURN EXACT MATCHING ACCURACY =====================')
501 exact_scores = [scores[turn]['exact'] for turn in turns]
502 print_formated_s("exact match", exact_scores, '{:<20.3f}')
503
504
505def evaluate(gold, predict, db_dir, etype, kmaps, plug_value, keep_distinct, progress_bar_for_each_datapoint):

Callers 1

evaluateFunction · 0.70

Calls 1

print_formated_sFunction · 0.70

Tested by

no test coverage detected