| import yaml |
| from aup_utils import get_aup |
| from plot_lines import plot_aup_curve |
| from plot_radar import plot_radar_chart |
| from plot_histogram import plot_histogram |
|
|
| DATA_PATHS = ['data_llada.yaml', 'data_dream.yaml', 'data_dream_coder.yaml'] |
| IS_DARK_MODE = True |
|
|
| |
| leaderboard = {} |
|
|
| |
| FONT_SIZES = { |
| 'data_llada': (22, 20, 18, 18, 21, 19, 17), |
| 'data_dream': (22, 20, 18, 18, 21, 19, 17), |
| 'data_dream_coder': (26, 24, 22, 18, 21, 19, 17), |
| } |
|
|
| |
| import os |
| os.makedirs('figs', exist_ok=True) |
|
|
| for DATA_PATH in DATA_PATHS: |
| print(f"\n{'='*60}\nProcessing {DATA_PATH}\n{'='*60}") |
| |
| with open(DATA_PATH, 'r') as f: |
| data = yaml.safe_load(f) |
| |
| TASK_LIST = list(data.keys()) |
| |
| |
| dataset_key = DATA_PATH.split('/')[-1].split('.')[0] |
| fs_axis, fs_legend, fs_tick, fs_radar_axis, fs_radar_legend, fs_hist_axis, fs_hist_legend = FONT_SIZES.get(dataset_key, (20, 18, 20, 18, 21, 19, 17)) |
| |
| |
| all_methods = set() |
| for task_data in data.values(): |
| all_methods.update(task_data.keys()) |
| all_methods.discard('EAGLE-3') |
| |
| num_methods = len(all_methods) |
| if num_methods == 3: |
| COLOR_LIST = ['orange', 'grey', 'red'] |
| elif num_methods == 6: |
| COLOR_LIST = ['orange', 'grey', 'purple', 'green', 'blue', 'red'] |
| else: |
| COLOR_LIST = ['orange', 'grey', 'purple', 'blue', 'red', 'green', 'cyan', 'magenta', 'pink', 'lime', 'teal', 'yellow'] |
| |
| radar_data = {} |
| |
| for TASK in TASK_LIST: |
| |
| all_methods_data = {} |
| methods_for_plot = {} |
| |
| for method_name, pairs in data[TASK].items(): |
| all_methods_data[method_name] = [(rho, y) for rho, y in pairs] |
| if method_name != 'EAGLE-3': |
| methods_for_plot[method_name] = [(rho, y) for rho, y in pairs] |
| |
| |
| y_max = max(y for pairs in all_methods_data.values() for _, y in pairs) |
| |
| print(f"\nAUP Results on {TASK.upper()}") |
| |
| for method_name, pairs in all_methods_data.items(): |
| rho, y = zip(*pairs) |
| aup = get_aup(list(rho), list(y), y_max, is_print=False) |
| print(f"{method_name:25s}: AUP = {aup:.4f}") |
| |
| |
| if method_name != 'EAGLE-3': |
| if method_name not in radar_data: |
| radar_data[method_name] = [] |
| radar_data[method_name].append(aup) |
| |
| |
| if method_name not in leaderboard: |
| leaderboard[method_name] = [] |
| leaderboard[method_name].append((TASK, aup)) |
| |
| |
| plot_aup_curve(methods_for_plot, y_max, assigned_colors=COLOR_LIST, save_path=f'figs/{dataset_key}_aup_curve_{TASK}.png', is_dark_mode=IS_DARK_MODE, font_size_axis=fs_axis, font_size_legend=fs_legend, font_size_tick=fs_tick, dataset_name=TASK) |
| |
| plot_radar_chart(radar_data, TASK_LIST, assigned_colors=COLOR_LIST, save_path=f'figs/{dataset_key}_aup_radar.png', is_dark_mode=IS_DARK_MODE, font_size_axis=fs_radar_axis, font_size_legend=fs_radar_legend) |
| plot_histogram(radar_data, TASK_LIST, assigned_colors=COLOR_LIST, save_path=f'figs/{dataset_key}_aup_histogram.png', is_dark_mode=IS_DARK_MODE, font_size_axis=fs_hist_axis, font_size_legend=fs_hist_legend) |
|
|
| |
| print(f"\n{'='*60}\nLEADERBOARD (Average AUP across all datasets)\n{'='*60}") |
| |
| excluded_tasks = {'humaneval+', 'mbpp+'} |
| avg_aup = {} |
| for method, task_scores in leaderboard.items(): |
| filtered_scores = [aup for task, aup in task_scores if task not in excluded_tasks] |
| avg_aup[method] = sum(filtered_scores) / 5.0 if filtered_scores else 0.0 |
|
|
| for method, avg in sorted(avg_aup.items(), key=lambda x: x[1], reverse=True): |
| print(f"{method:25s}: {avg:.4f}") |
| print('='*60) |
|
|