grg commited on
Commit
abbad6f
β€’
1 Parent(s): ace58da

Adding hover descriptions to the table

Browse files
Files changed (1) hide show
  1. utils.py +22 -3
utils.py CHANGED
@@ -5,10 +5,29 @@ def df_to_table_html(df, additional_class=None):
5
  if additional_class is not None:
6
  classes += f" {additional_class}"
7
 
8
- full_table_html = df.to_html(classes=classes, escape=False, index=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  # Modify the table HTML to add links to model names
11
  for model in df['Model']:
12
  model_link = f'<a href="{url_for("model_detail", model_name=model)}">{model}</a>'
13
- full_table_html = full_table_html.replace(f'>{model}<', f'>{model_link}<')
14
- return full_table_html
 
 
5
  if additional_class is not None:
6
  classes += f" {additional_class}"
7
 
8
+ # Define descriptions for each metric
9
+ descriptions = {
10
+ "Ordinal - Win rate (↑)": "Percentage of won games - a game is a comparison between each model pair, each metric, and each context pair (for stability) or context (for validity metrics).",
11
+ "Cardinal - Score (↑)": "Average score over all metrics (with descending metrics inverted), context pairs (for stability) and contexts ( for validity metrics).",
12
+ "RO Stability (↑)": "Correlation in the order of simulated participants (ordered based on the expression of the same values) over different contexts",
13
+ "Stress (↓)": "MDS fit of the observed value structure to the theoretical circular structure. Stress of 0 indicates 'perfect' fit, 0.025 excellent, 0.05 good, 0.1 fair, and 0.2 poor.",
14
+ "Separability (↑)": "Linear separability (in the 2D MDS space) of questions corresponding to different values (linear multi-label SVM classifier accuracy).",
15
+ "CFI (↑)": "Fit of the posited Magnifying glass CFA model (>.90 is considered acceptable fit).",
16
+ "SRMR (↓)": "Fit of the posited Magnifying glass CFA model (<.05 considered good fit and <.08 reasonable).",
17
+ "RMSEA (↓)": "Fit of the posited Magnifying glass CFA model (<.05 considered good fit and <.08 reasonable)."
18
+ }
19
+
20
+
21
+ # Convert DataFrame to HTML
22
+ html = df.to_html(classes=classes, escape=False, index=False)
23
+
24
+ # Add title attributes to metric names
25
+ for metric, description in descriptions.items():
26
+ html = html.replace(f'>{metric}<', f' title="{description}">{metric}<')
27
 
28
  # Modify the table HTML to add links to model names
29
  for model in df['Model']:
30
  model_link = f'<a href="{url_for("model_detail", model_name=model)}">{model}</a>'
31
+ html = html.replace(f'>{model}<', f'>{model_link}<')
32
+
33
+ return html