Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -791,7 +791,25 @@ def _build_grid_summary_figure():
|
|
| 791 |
row_order = pivot.max(axis=1).sort_values(ascending=True).index.tolist()
|
| 792 |
pivot = pivot.loc[row_order]
|
| 793 |
|
| 794 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 795 |
|
| 796 |
fig = go.Figure(go.Heatmap(
|
| 797 |
z=pivot.values,
|
|
@@ -805,17 +823,6 @@ def _build_grid_summary_figure():
|
|
| 805 |
hovertemplate="Model: %{y}<br>Threshold: %{x}<br>Mean silhouette: %{z:.3f}<extra></extra>",
|
| 806 |
))
|
| 807 |
|
| 808 |
-
# Star annotation on the best cell
|
| 809 |
-
best = agg.loc[agg["silhouette_cosine"].idxmax()]
|
| 810 |
-
fig.add_annotation(
|
| 811 |
-
x=str(best["threshold"]),
|
| 812 |
-
y=_short(best["model"]),
|
| 813 |
-
text="★",
|
| 814 |
-
showarrow=False,
|
| 815 |
-
font=dict(size=18, color="#1a3a5c"),
|
| 816 |
-
xref="x", yref="y",
|
| 817 |
-
)
|
| 818 |
-
|
| 819 |
n_models = len(pivot.index)
|
| 820 |
fig.update_layout(
|
| 821 |
title=dict(
|
|
|
|
| 791 |
row_order = pivot.max(axis=1).sort_values(ascending=True).index.tolist()
|
| 792 |
pivot = pivot.loc[row_order]
|
| 793 |
|
| 794 |
+
# Embed star in the best cell's text (avoids categorical axis coordinate issues)
|
| 795 |
+
best_idx = agg["silhouette_cosine"].idxmax()
|
| 796 |
+
best = agg.loc[best_idx]
|
| 797 |
+
best_short = _short(best["model"])
|
| 798 |
+
best_thresh = best["threshold"]
|
| 799 |
+
|
| 800 |
+
rows_list = list(pivot.index)
|
| 801 |
+
cols_list = list(pivot.columns)
|
| 802 |
+
text = []
|
| 803 |
+
for ri, row_name in enumerate(rows_list):
|
| 804 |
+
row_text = []
|
| 805 |
+
for ci, col_val in enumerate(cols_list):
|
| 806 |
+
v = pivot.iloc[ri, ci]
|
| 807 |
+
if pd.notna(v):
|
| 808 |
+
cell = f"★ {v:.3f}" if (row_name == best_short and col_val == best_thresh) else f"{v:.3f}"
|
| 809 |
+
else:
|
| 810 |
+
cell = ""
|
| 811 |
+
row_text.append(cell)
|
| 812 |
+
text.append(row_text)
|
| 813 |
|
| 814 |
fig = go.Figure(go.Heatmap(
|
| 815 |
z=pivot.values,
|
|
|
|
| 823 |
hovertemplate="Model: %{y}<br>Threshold: %{x}<br>Mean silhouette: %{z:.3f}<extra></extra>",
|
| 824 |
))
|
| 825 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 826 |
n_models = len(pivot.index)
|
| 827 |
fig.update_layout(
|
| 828 |
title=dict(
|