David Dale commited on
Commit
1d0b778
·
1 Parent(s): f7ac4d6

early column rename

Browse files
Files changed (1) hide show
  1. leaderboard.py +7 -6
leaderboard.py CHANGED
@@ -34,8 +34,9 @@ Descriptions of the implementation of the systems will come out later.
34
 
35
  def leaderboard_tab():
36
  stats = pd.read_csv("data/benchmark_stats.tsv", sep="\t", quoting=csv.QUOTE_NONE)
 
37
 
38
- metrics = ['score_metricx_both', 'score_xcomet_both', 'score_CHRFpp', 'score_glotlid_ref']
39
  systems = sorted(set(stats["system"]))
40
  ALL = "ALL"
41
  MEAN = "Average"
@@ -73,7 +74,7 @@ def leaderboard_tab():
73
  filtered = filtered[filtered["src_lang"].eq(src_lang)]
74
  if tgt_lang != ALL:
75
  filtered = filtered[filtered["tgt_lang"].eq(tgt_lang)]
76
- means = filtered.groupby(['system'])[metrics].mean().reset_index().sort_values('score_metricx_both')
77
  means.columns = [strip_colname(c) for c in means.columns]
78
  styler = means.style.background_gradient().format(precision=4)
79
  return styler
@@ -106,7 +107,7 @@ def leaderboard_tab():
106
  gr.Markdown("## Languages difficulty")
107
  gr_system = gr.Dropdown([MEAN] + systems, value=MEAN, label="Translation system")
108
  gr_direction = gr.Dropdown([XX2EN, EN2XX], value=XX2EN, label="Translation direction")
109
- gr_metric = gr.Dropdown(metrics, label="Quality metric", value="score_metricx_both")
110
  bar_controls = [gr_system, gr_direction, gr_metric]
111
 
112
  def get_hist(system, direction, metric):
@@ -125,12 +126,12 @@ def leaderboard_tab():
125
 
126
  # Compute the means and update the plot
127
  means = subset.groupby(lang_col)[metric].mean().sort_values(
128
- ascending=(metric=="score_metricx_both")
129
  )
130
  means = means.to_frame().reset_index()
131
  return gr.update(
132
- value=means, x=lang_col, y=metric, caption=metric, x_label_angle=-90,
133
- height=300,
134
  sort="y",
135
  )
136
 
 
34
 
35
  def leaderboard_tab():
36
  stats = pd.read_csv("data/benchmark_stats.tsv", sep="\t", quoting=csv.QUOTE_NONE)
37
+ stats.columns = [strip_colname(c) for c in stats.columns]
38
 
39
+ metrics = ['metricx_both', 'xcomet_both', 'CHRFpp', 'glotlid_ref']
40
  systems = sorted(set(stats["system"]))
41
  ALL = "ALL"
42
  MEAN = "Average"
 
74
  filtered = filtered[filtered["src_lang"].eq(src_lang)]
75
  if tgt_lang != ALL:
76
  filtered = filtered[filtered["tgt_lang"].eq(tgt_lang)]
77
+ means = filtered.groupby(['system'])[metrics].mean().reset_index().sort_values('metricx_both')
78
  means.columns = [strip_colname(c) for c in means.columns]
79
  styler = means.style.background_gradient().format(precision=4)
80
  return styler
 
107
  gr.Markdown("## Languages difficulty")
108
  gr_system = gr.Dropdown([MEAN] + systems, value=MEAN, label="Translation system")
109
  gr_direction = gr.Dropdown([XX2EN, EN2XX], value=XX2EN, label="Translation direction")
110
+ gr_metric = gr.Dropdown(metrics, label="Quality metric", value="metricx_both")
111
  bar_controls = [gr_system, gr_direction, gr_metric]
112
 
113
  def get_hist(system, direction, metric):
 
126
 
127
  # Compute the means and update the plot
128
  means = subset.groupby(lang_col)[metric].mean().sort_values(
129
+ ascending=(metric=="metricx_both")
130
  )
131
  means = means.to_frame().reset_index()
132
  return gr.update(
133
+ value=means, x=lang_col, y=metric, x_label_angle=-90,
134
+ height=500,
135
  sort="y",
136
  )
137