rzanoli commited on
Commit
b0db80c
·
1 Parent(s): 9cfb29f

Small changes

Browse files
Files changed (1) hide show
  1. app.py +19 -99
app.py CHANGED
@@ -189,13 +189,13 @@ def boxplot_per_task(dataframe=None, baselines=None):
189
 
190
  fig.add_annotation(
191
  text=(
192
- " In tasks like TE and SA, zero/few-shot models reach accuracy close to supervised <br> "
193
- "methods at EVALITA (dashed line); in NER and REL they remain much lower. "
194
  ),
195
  xref="paper", yref="paper",
196
  x=0.5, y=-0.30,
197
  showarrow=False,
198
- font=dict(size=12, color="gray"),
199
  align="left"
200
  )
201
 
@@ -279,112 +279,27 @@ def boxplot_prompts_per_task(dataframe, tasks=None):
279
  barmode='group',
280
  template="plotly_white",
281
  font=dict(family="Arial", size=10),
282
- yaxis=dict(range=[0, 100], fixedrange=True),
283
  )
284
 
285
- # Aggiungi la caption come annotazione separata
286
  fig.add_annotation(
287
  text="There is no single prompt that performs best across all tasks.<br>"
288
  "Different prompts achieve the highest accuracy on different tasks.",
289
  xref="paper", yref="paper",
290
- x=0, y=-0.3,
291
- showarrow=False,
292
- font=dict(size=11, color="gray"),
293
- align="left"
294
- )
295
-
296
- return fig
297
-
298
- def line_chart2(dataframe):
299
-
300
- # Normalizziamo le dimensioni per avere marker non troppo piccoli né enormi
301
- def scale_sizes(values, min_size=8, max_size=30):
302
- vmin, vmax = min(values), max(values)
303
- return [
304
- min_size + (val - vmin) / (vmax - vmin) * (max_size - min_size) if vmax > vmin else (min_size + max_size) / 2
305
- for val in values
306
- ]
307
-
308
- # Separiamo i dati in base a IS_FS
309
- df_true = dataframe[dataframe['IS_FS'] == True]
310
- df_false = dataframe[dataframe['IS_FS'] == False]
311
-
312
- # Estrai valori x, y e labels
313
- x_true = df_true['#Params (B)'].tolist()
314
- y_true = df_true['Avg. Comb. Perf. ⬆️'].tolist()
315
- labels_true = [re.search(r'>([^<]+)<', m).group(1) for m in df_true['Model'].tolist()]
316
-
317
- x_false = df_false['#Params (B)'].tolist()
318
- y_false = df_false['Avg. Comb. Perf. ⬆️'].tolist()
319
- labels_false = [re.search(r'>([^<]+)<', m).group(1) for m in df_false['Model'].tolist()]
320
-
321
- fig = go.Figure()
322
-
323
- # Punti IS_FS=True
324
- fig.add_trace(go.Scatter(
325
- x=x_true,
326
- y=y_true,
327
- mode='markers',
328
- name='5-Shot',
329
- marker=dict(
330
- color='blue',
331
- size=scale_sizes(x_true) # marker più grandi se #Params è grande
332
- ),
333
- hovertemplate='<b>%{customdata}</b><br>#Params: %{x}<br>Performance: %{y}<extra></extra>',
334
- customdata=labels_true
335
- ))
336
-
337
- # Punti IS_FS=False
338
- fig.add_trace(go.Scatter(
339
- x=x_false,
340
- y=y_false,
341
- mode='markers',
342
- name='0-Shot',
343
- marker=dict(
344
- color='red',
345
- size=scale_sizes(x_false)
346
- ),
347
- hovertemplate='<b>%{customdata}</b><br>#Params: %{x}<br>Performance: %{y}<extra></extra>',
348
- customdata=labels_false
349
- ))
350
-
351
- fig.update_layout(
352
- title="Avg. Combined Performance vs #Params",
353
- xaxis_title="#Params (B)",
354
- yaxis_title="Avg. Combined Performance",
355
- template="plotly_white",
356
- hovermode="closest",
357
- font=dict(family="Arial", size=10),
358
- dragmode=False,
359
- xaxis=dict(
360
- tickvals=[0, 25, 50, 75, 100, 125], # valori che vuoi mostrare
361
- ticktext=["0", "25", "50", "75", "100"]
362
- )
363
- )
364
-
365
- # Caption
366
- fig.add_annotation(
367
- text="Accuracy generally rises with #Params, but smaller models with 5-shot <br> "
368
- "can outperform larger zero-shot models.",
369
- xref="paper", yref="paper",
370
- x=0, y=-0.3,
371
  showarrow=False,
372
  font=dict(size=11, color="gray"),
373
- align="left"
 
374
  )
375
 
376
- fig.update_xaxes(fixedrange=True, rangeslider_visible=False)
377
- fig.update_yaxes(fixedrange=True)
378
-
379
  return fig
380
 
381
 
382
  def line_chart(dataframe):
383
 
384
- import re
385
- import plotly.graph_objects as go
386
-
387
- # Normalizziamo le dimensioni per avere marker non troppo piccoli né enormi
388
  def scale_sizes(values, min_size=8, max_size=30):
389
  vmin, vmax = min(values), max(values)
390
  return [
@@ -392,7 +307,7 @@ def line_chart(dataframe):
392
  for val in values
393
  ]
394
 
395
- # Separiamo i dati in base a IS_FS
396
  df_true = dataframe[dataframe['IS_FS'] == True]
397
  df_false = dataframe[dataframe['IS_FS'] == False]
398
 
@@ -473,18 +388,23 @@ def line_chart(dataframe):
473
  xaxis=dict(
474
  tickvals=[0, 25, 50, 75, 100, 125],
475
  ticktext=["0", "25", "50", "75", "100"]
 
 
 
 
476
  )
477
  )
478
 
479
  # Caption
480
  fig.add_annotation(
481
- text="Accuracy generally rises with #Params, but smaller models with 5-shot <br>"
482
- "can outperform larger zero-shot models.",
483
  xref="paper", yref="paper",
484
- x=0, y=-0.3,
485
  showarrow=False,
486
  font=dict(size=11, color="gray"),
487
- align="left"
 
488
  )
489
 
490
  fig.update_xaxes(fixedrange=True, rangeslider_visible=False)
 
189
 
190
  fig.add_annotation(
191
  text=(
192
+ "In tasks like TE and SA, models approach the accuracy of supervised <br>"
193
+ "models at EVALITA (dashed line); in NER and REL they remain lower."
194
  ),
195
  xref="paper", yref="paper",
196
  x=0.5, y=-0.30,
197
  showarrow=False,
198
+ font=dict(size=11, color="gray"),
199
  align="left"
200
  )
201
 
 
279
  barmode='group',
280
  template="plotly_white",
281
  font=dict(family="Arial", size=10),
282
+ yaxis=dict(range=[0, 100], fixedrange=True)
283
  )
284
 
285
+ # caption come annotazione separata
286
  fig.add_annotation(
287
  text="There is no single prompt that performs best across all tasks.<br>"
288
  "Different prompts achieve the highest accuracy on different tasks.",
289
  xref="paper", yref="paper",
290
+ x=0.5, y=-0.3,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  showarrow=False,
292
  font=dict(size=11, color="gray"),
293
+ align="center",
294
+ xanchor="center"
295
  )
296
 
 
 
 
297
  return fig
298
 
299
 
300
  def line_chart(dataframe):
301
 
302
+ # Normalizza le dimensioni per avere marker non troppo piccoli né enormi
 
 
 
303
  def scale_sizes(values, min_size=8, max_size=30):
304
  vmin, vmax = min(values), max(values)
305
  return [
 
307
  for val in values
308
  ]
309
 
310
+ # dati in base a IS_FS
311
  df_true = dataframe[dataframe['IS_FS'] == True]
312
  df_false = dataframe[dataframe['IS_FS'] == False]
313
 
 
388
  xaxis=dict(
389
  tickvals=[0, 25, 50, 75, 100, 125],
390
  ticktext=["0", "25", "50", "75", "100"]
391
+ ),
392
+ yaxis=dict(
393
+ tickvals=[0, 20, 40, 60, 80, 100], # 👈 tick fissi
394
+ range=[0, 100] # 👈 range bloccato
395
  )
396
  )
397
 
398
  # Caption
399
  fig.add_annotation(
400
+ text="Accuracy generally rises with #Params, but smaller models <br>"
401
+ "with 5-shot can outperform larger zero-shot models.",
402
  xref="paper", yref="paper",
403
+ x=0.5, y=-0.3, # 👈 centrata
404
  showarrow=False,
405
  font=dict(size=11, color="gray"),
406
+ align="center",
407
+ xanchor="center" # 👈 ancora centrata rispetto al testo
408
  )
409
 
410
  fig.update_xaxes(fixedrange=True, rangeslider_visible=False)