Spaces:
Sleeping
Sleeping
Update src/vis_utils.py
Browse files- src/vis_utils.py +9 -3
src/vis_utils.py
CHANGED
@@ -186,6 +186,14 @@ def plot_family_results(method_names, dataset, family_path="/tmp/family_results.
|
|
186 |
# Reshape the DataFrame to long format
|
187 |
df_long = pd.melt(df, id_vars=["Method"], value_vars=value_vars, var_name="Dataset_Metric_Fold", value_name="Value")
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
# Split the "Dataset_Metric_Fold" column into "Metric" and "Fold"
|
190 |
df_long[["Metric", "Fold"]] = df_long["Dataset_Metric_Fold"].str[len(dataset) + 1:].str.split("_", expand=True)
|
191 |
df_long["Fold"] = df_long["Fold"].astype(int)
|
@@ -241,8 +249,6 @@ def plot_affinity_results(method_names, metric, affinity_path="/tmp/affinity_res
|
|
241 |
df = df.fillna(0)
|
242 |
|
243 |
df = df.T
|
244 |
-
|
245 |
-
print(df)
|
246 |
# Set up the plot
|
247 |
sns.set(rc={'figure.figsize': (11.7, 8.27)})
|
248 |
sns.set_theme(style="whitegrid", color_codes=True)
|
@@ -304,7 +310,7 @@ def update_metric_choices(benchmark_type):
|
|
304 |
return (
|
305 |
gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
|
306 |
gr.update(choices=datasets, value=datasets[0], visible=True),
|
307 |
-
gr.update(
|
308 |
)
|
309 |
elif benchmark_type == 'affinity':
|
310 |
# Show single metric selector for affinity
|
|
|
186 |
# Reshape the DataFrame to long format
|
187 |
df_long = pd.melt(df, id_vars=["Method"], value_vars=value_vars, var_name="Dataset_Metric_Fold", value_name="Value")
|
188 |
|
189 |
+
print(df_long)
|
190 |
+
|
191 |
+
# Convert the "Value" column to numeric
|
192 |
+
df_long["Value"] = pd.to_numeric(df_long["Value"], errors="coerce")
|
193 |
+
|
194 |
+
# Drop rows with NaN values in "Value"
|
195 |
+
df_long = df_long.dropna(subset=["Value"])
|
196 |
+
|
197 |
# Split the "Dataset_Metric_Fold" column into "Metric" and "Fold"
|
198 |
df_long[["Metric", "Fold"]] = df_long["Dataset_Metric_Fold"].str[len(dataset) + 1:].str.split("_", expand=True)
|
199 |
df_long["Fold"] = df_long["Fold"].astype(int)
|
|
|
249 |
df = df.fillna(0)
|
250 |
|
251 |
df = df.T
|
|
|
|
|
252 |
# Set up the plot
|
253 |
sns.set(rc={'figure.figsize': (11.7, 8.27)})
|
254 |
sns.set_theme(style="whitegrid", color_codes=True)
|
|
|
310 |
return (
|
311 |
gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
|
312 |
gr.update(choices=datasets, value=datasets[0], visible=True),
|
313 |
+
gr.update(visible=False)
|
314 |
)
|
315 |
elif benchmark_type == 'affinity':
|
316 |
# Show single metric selector for affinity
|