Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -816,9 +816,24 @@ def _build_grid_summary_figure(field=None, min_size=None, metric="silhouette_cos
|
|
| 816 |
index="short_model", columns="threshold",
|
| 817 |
values=metric, aggfunc="mean",
|
| 818 |
)
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
pivot = pivot.loc[row_order]
|
| 823 |
|
| 824 |
# Identify best cell and embed star in cell text
|
|
|
|
| 816 |
index="short_model", columns="threshold",
|
| 817 |
values=metric, aggfunc="mean",
|
| 818 |
)
|
| 819 |
+
|
| 820 |
+
# Always sort rows by silhouette score so all three heatmaps share the same model order
|
| 821 |
+
sil_src = METRICS_DF.dropna(subset=["silhouette_cosine"])
|
| 822 |
+
if field and field != "__global__":
|
| 823 |
+
sil_src = sil_src[sil_src["field"] == field]
|
| 824 |
+
if min_size and min_size != "__all__":
|
| 825 |
+
try:
|
| 826 |
+
sil_src = sil_src[sil_src["min_community_size"] == int(min_size)]
|
| 827 |
+
except (ValueError, TypeError):
|
| 828 |
+
pass
|
| 829 |
+
sil_agg = sil_src.groupby("model")["silhouette_cosine"].mean()
|
| 830 |
+
sil_agg.index = sil_agg.index.map(_short)
|
| 831 |
+
# Models present in pivot but missing from silhouette get ranked last
|
| 832 |
+
row_order = (
|
| 833 |
+
sil_agg.reindex(pivot.index, fill_value=0)
|
| 834 |
+
.sort_values(ascending=True) # ascending=True → worst at bottom, best at top in Plotly
|
| 835 |
+
.index.tolist()
|
| 836 |
+
)
|
| 837 |
pivot = pivot.loc[row_order]
|
| 838 |
|
| 839 |
# Identify best cell and embed star in cell text
|