Spaces:
Sleeping
Sleeping
Commit
·
104fcb7
1
Parent(s):
20962a2
Include Extra Dataset In Heatmap
Browse files
app.py
CHANGED
@@ -1057,6 +1057,14 @@ def run_model(model_name):
|
|
1057 |
|
1058 |
st.write(f"Regresión global (Nueva PCA): R² = {r2_new:.4f}, Slope = {slope_new:.4f}, Intercept = {intercept_new:.4f}")
|
1059 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1060 |
# --- INICIO DEL BLOQUE: Heatmap de características ---
|
1061 |
st.markdown("## Heatmap de Características")
|
1062 |
|
@@ -1083,9 +1091,12 @@ def run_model(model_name):
|
|
1083 |
|
1084 |
# Extraemos las características disponibles (excluyendo 'name')
|
1085 |
feature_options = [col for col in df_heat.columns if col != "name"]
|
1086 |
-
selected_feature = st.selectbox("
|
1087 |
options=feature_options, key=f"heatmap_{model_name}")
|
1088 |
|
|
|
|
|
|
|
1089 |
# Determinar el rango de las posiciones (x, y) de las muestras reales
|
1090 |
x_min, x_max = df_heatmap['x'].min(), df_heatmap['x'].max()
|
1091 |
y_min, y_max = df_heatmap['y'].min(), df_heatmap['y'].max()
|
@@ -1168,6 +1179,22 @@ def run_model(model_name):
|
|
1168 |
# Dibujar círculos con transparencia total (no se verán)
|
1169 |
invisible_renderer = heatmap_fig.circle('x', 'y', size=10, source=source_points, fill_alpha=0, line_alpha=0.5)
|
1170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
hover_tool_points = HoverTool(renderers=[invisible_renderer], tooltips=TOOLTIPS)
|
1172 |
heatmap_fig.add_tools(hover_tool_points)
|
1173 |
|
|
|
1057 |
|
1058 |
st.write(f"Regresión global (Nueva PCA): R² = {r2_new:.4f}, Slope = {slope_new:.4f}, Intercept = {intercept_new:.4f}")
|
1059 |
|
1060 |
+
|
1061 |
+
|
1062 |
+
|
1063 |
+
|
1064 |
+
|
1065 |
+
|
1066 |
+
|
1067 |
+
|
1068 |
# --- INICIO DEL BLOQUE: Heatmap de características ---
|
1069 |
st.markdown("## Heatmap de Características")
|
1070 |
|
|
|
1091 |
|
1092 |
# Extraemos las características disponibles (excluyendo 'name')
|
1093 |
feature_options = [col for col in df_heat.columns if col != "name"]
|
1094 |
+
selected_feature = st.selectbox("Select heatmap feature:",
|
1095 |
options=feature_options, key=f"heatmap_{model_name}")
|
1096 |
|
1097 |
+
select_extra_dataset_hm = st.selectbox("Select a dataset:",
|
1098 |
+
options=["-", "es-digital-seq", "es-digital-rotation-degradation-seq", "es-digital-zoom-degradation-seq", "es-render-seq"], key=f"heatmap_extra_dataset_{model_name}")
|
1099 |
+
|
1100 |
# Determinar el rango de las posiciones (x, y) de las muestras reales
|
1101 |
x_min, x_max = df_heatmap['x'].min(), df_heatmap['x'].max()
|
1102 |
y_min, y_max = df_heatmap['y'].min(), df_heatmap['y'].max()
|
|
|
1179 |
# Dibujar círculos con transparencia total (no se verán)
|
1180 |
invisible_renderer = heatmap_fig.circle('x', 'y', size=10, source=source_points, fill_alpha=0, line_alpha=0.5)
|
1181 |
|
1182 |
+
if select_extra_dataset_hm != "-":
|
1183 |
+
df_extra = df_all["synthetic"][df_all["synthetic"]["source"] == select_extra_dataset_hm]
|
1184 |
+
# Asegurarse de que exista la columna 'name'
|
1185 |
+
if 'name' not in df_extra.columns:
|
1186 |
+
df_extra["name"] = df_extra["img"].apply(
|
1187 |
+
lambda x: x.split("/")[-1].replace(".png", "") if isinstance(x, str) else x
|
1188 |
+
)
|
1189 |
+
source_extra_points = ColumnDataSource(data={
|
1190 |
+
'x': df_extra['x'],
|
1191 |
+
'y': df_extra['y'],
|
1192 |
+
'img': df_extra['img'],
|
1193 |
+
'label': df_extra['name']
|
1194 |
+
})
|
1195 |
+
# Agregar renderer para el dataset extra
|
1196 |
+
extra_renderer = heatmap_fig.circle('x', 'y', size=10, source=source_extra_points, fill_alpha=0, line_alpha=0.5, color="red")
|
1197 |
+
|
1198 |
hover_tool_points = HoverTool(renderers=[invisible_renderer], tooltips=TOOLTIPS)
|
1199 |
heatmap_fig.add_tools(hover_tool_points)
|
1200 |
|