magilogi commited on
Commit
c5ae15c
β€’
1 Parent(s): 5542fa4

adjusted score change

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -54,17 +54,14 @@ df.rename(columns={
54
  }, inplace=True)
55
 
56
  #Create adjusted robustness score that accounts for g2b accuracy and difference in accuracy
57
- # (models with low difference like phi will seem robust, but its simply because they are bad / random at both tasks)
58
  df['Average Accuracy (Original and G2B)'] = (df['Average G2B Accuracy'] + df['Average Original Accuracy']) / 2
59
 
 
60
 
 
61
 
62
- # Introduce a penalty factor for low average accuracy
63
- penalty_factor = 1 / (df['Average Accuracy (Original and G2B)'] ** 2)
64
 
65
- # Calculate the adjusted robustness score with penalty
66
- df['Adjusted Robustness Score'] = df['Average Difference'] * penalty_factor
67
- df['Adjusted Robustness Score'] = df['Adjusted Robustness Score'].round(2)
68
 
69
 
70
 
@@ -157,6 +154,18 @@ def create_bar_plot_drugmatchqa(df, col, title):
157
  fig.update_layout(xaxis_title=col, yaxis_title='Model', height=600, coloraxis_showscale=False)
158
  return fig
159
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  #Create UI/Layout
161
 
162
  with gr.Blocks(css="custom.css") as demo:
@@ -317,7 +326,7 @@ with gr.Blocks(css="custom.css") as demo:
317
  elem_id="bar3"
318
  )
319
  bar4 = gr.Plot(
320
- value=create_bar_plot_drugmatchqa(df, "Adjusted Robustness Score", "Which LLMs are most robust to drug name synonym substitution?"),
321
  elem_id="bar4"
322
  )
323
 
 
54
  }, inplace=True)
55
 
56
  #Create adjusted robustness score that accounts for g2b accuracy and difference in accuracy
57
+
58
  df['Average Accuracy (Original and G2B)'] = (df['Average G2B Accuracy'] + df['Average Original Accuracy']) / 2
59
 
60
+ df['Adjusted Robustness Score'] = (df['Average Difference'] / (df['Average Accuracy (Original and G2B)'] ** 2)) * 100
61
 
62
+ df['Adjusted Robustness Score'] = df['Adjusted Robustness Score'].round(2)
63
 
 
 
64
 
 
 
 
65
 
66
 
67
 
 
154
  fig.update_layout(xaxis_title=col, yaxis_title='Model', height=600, coloraxis_showscale=False)
155
  return fig
156
 
157
+ def create_bar_plot_adjusted(df, col, title):
158
+ sorted_df = df.sort_values(by=col, ascending=True)
159
+ fig = px.bar(sorted_df,
160
+ x=col,
161
+ y='Model',
162
+ orientation='h',
163
+ title=title,
164
+ color=col,
165
+ color_continuous_scale='Aggrnyl')
166
+ fig.update_layout(xaxis_title=col, yaxis_title='Model', height=600, coloraxis_showscale=False)
167
+ return fig
168
+
169
  #Create UI/Layout
170
 
171
  with gr.Blocks(css="custom.css") as demo:
 
326
  elem_id="bar3"
327
  )
328
  bar4 = gr.Plot(
329
+ value=create_bar_plot_adjusted(df, "Adjusted Robustness Score", "Which LLMs are most robust to drug name synonym substitution?"),
330
  elem_id="bar4"
331
  )
332