Simplify analysis data tables
Browse files
app.py
CHANGED
|
@@ -1188,7 +1188,7 @@ def feature_figures(
|
|
| 1188 |
) -> tuple[go.Figure, pd.DataFrame]:
|
| 1189 |
frame = feature_frame(dataset, models)
|
| 1190 |
if frame.empty:
|
| 1191 |
-
columns = ["method", "
|
| 1192 |
return empty_figure("No results for this selection."), pd.DataFrame(columns=columns)
|
| 1193 |
score_column, target, metric, reference = feature_spec(dataset)
|
| 1194 |
validation = frame.dropna(subset=["validation_score"]).sort_values(
|
|
@@ -1218,7 +1218,7 @@ def feature_figures(
|
|
| 1218 |
validation_fig.update_yaxes(title="", showgrid=False)
|
| 1219 |
figure_layout(validation_fig, height=max(430, 25 * len(validation) + 145))
|
| 1220 |
|
| 1221 |
-
columns = ["method", "
|
| 1222 |
return validation_fig, round_numeric(
|
| 1223 |
frame[columns].sort_values("validation_score", ascending=False)
|
| 1224 |
)
|
|
@@ -1965,7 +1965,7 @@ def consistency_figures(
|
|
| 1965 |
if dataset == "mc_pacman"
|
| 1966 |
else "No latent-consistency result is available for this selection."
|
| 1967 |
)
|
| 1968 |
-
columns = ["method", "latent_consistency_r2"
|
| 1969 |
return empty_figure(message), consistency_heatmap(models), pd.DataFrame(columns=columns)
|
| 1970 |
bar = frame.sort_values(["latent_consistency_r2", "model_order"], ascending=[True, False])
|
| 1971 |
bar_fig = go.Figure(
|
|
@@ -1974,19 +1974,14 @@ def consistency_figures(
|
|
| 1974 |
y=bar["method"],
|
| 1975 |
orientation="h",
|
| 1976 |
marker=dict(color=CONSISTENCY_COLOR),
|
| 1977 |
-
|
| 1978 |
-
hovertemplate=(
|
| 1979 |
-
"Method=%{y}<br>Latent-consistency R²=%{x:.4f}<br>"
|
| 1980 |
-
"Recordings=%{customdata[0]:.0f}<br>Latent dimensions=%{customdata[1]:.0f}<br>"
|
| 1981 |
-
"Directional pairs=%{customdata[2]:.0f}<extra></extra>"
|
| 1982 |
-
),
|
| 1983 |
)
|
| 1984 |
)
|
| 1985 |
bar_fig.update_layout(title="Latent consistency")
|
| 1986 |
bar_fig.update_xaxes(title="Latent-consistency R²", range=[0, 1.02])
|
| 1987 |
bar_fig.update_yaxes(title="", showgrid=False)
|
| 1988 |
figure_layout(bar_fig, height=max(400, 27 * len(bar) + 145))
|
| 1989 |
-
columns = ["method", "latent_consistency_r2"
|
| 1990 |
return bar_fig, consistency_heatmap(models), frame[columns].sort_values("latent_consistency_r2", ascending=False)
|
| 1991 |
|
| 1992 |
|
|
@@ -2485,11 +2480,11 @@ def update_consistency(
|
|
| 2485 |
def update_feature(dataset: str, models: list[str] | None):
|
| 2486 |
dataset = dataset or DATASETS[0]
|
| 2487 |
validation_fig, table = feature_figures(dataset, models)
|
| 2488 |
-
_column, _target,
|
| 2489 |
if dataset == "allen_neuropixels":
|
| 2490 |
definition = (
|
| 2491 |
-
"Spearman’s ρ measures association
|
| 2492 |
-
"
|
| 2493 |
)
|
| 2494 |
elif dataset == "ratinabox":
|
| 2495 |
definition = (
|
|
@@ -2501,11 +2496,15 @@ def update_feature(dataset: str, models: list[str] | None):
|
|
| 2501 |
"ROC-AUC measures whether recorded neural features rank above appended "
|
| 2502 |
"synthetic controls. Chance ROC-AUC is 0.5."
|
| 2503 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2504 |
return (
|
| 2505 |
definition,
|
| 2506 |
validation_fig,
|
| 2507 |
feature_heatmap(models),
|
| 2508 |
-
|
| 2509 |
records(table),
|
| 2510 |
)
|
| 2511 |
|
|
|
|
| 1188 |
) -> tuple[go.Figure, pd.DataFrame]:
|
| 1189 |
frame = feature_frame(dataset, models)
|
| 1190 |
if frame.empty:
|
| 1191 |
+
columns = ["method", "validation_score"]
|
| 1192 |
return empty_figure("No results for this selection."), pd.DataFrame(columns=columns)
|
| 1193 |
score_column, target, metric, reference = feature_spec(dataset)
|
| 1194 |
validation = frame.dropna(subset=["validation_score"]).sort_values(
|
|
|
|
| 1218 |
validation_fig.update_yaxes(title="", showgrid=False)
|
| 1219 |
figure_layout(validation_fig, height=max(430, 25 * len(validation) + 145))
|
| 1220 |
|
| 1221 |
+
columns = ["method", "validation_score"]
|
| 1222 |
return validation_fig, round_numeric(
|
| 1223 |
frame[columns].sort_values("validation_score", ascending=False)
|
| 1224 |
)
|
|
|
|
| 1965 |
if dataset == "mc_pacman"
|
| 1966 |
else "No latent-consistency result is available for this selection."
|
| 1967 |
)
|
| 1968 |
+
columns = ["method", "latent_consistency_r2"]
|
| 1969 |
return empty_figure(message), consistency_heatmap(models), pd.DataFrame(columns=columns)
|
| 1970 |
bar = frame.sort_values(["latent_consistency_r2", "model_order"], ascending=[True, False])
|
| 1971 |
bar_fig = go.Figure(
|
|
|
|
| 1974 |
y=bar["method"],
|
| 1975 |
orientation="h",
|
| 1976 |
marker=dict(color=CONSISTENCY_COLOR),
|
| 1977 |
+
hovertemplate="Method=%{y}<br>Latent-consistency R²=%{x:.4f}<extra></extra>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1978 |
)
|
| 1979 |
)
|
| 1980 |
bar_fig.update_layout(title="Latent consistency")
|
| 1981 |
bar_fig.update_xaxes(title="Latent-consistency R²", range=[0, 1.02])
|
| 1982 |
bar_fig.update_yaxes(title="", showgrid=False)
|
| 1983 |
figure_layout(bar_fig, height=max(400, 27 * len(bar) + 145))
|
| 1984 |
+
columns = ["method", "latent_consistency_r2"]
|
| 1985 |
return bar_fig, consistency_heatmap(models), frame[columns].sort_values("latent_consistency_r2", ascending=False)
|
| 1986 |
|
| 1987 |
|
|
|
|
| 2480 |
def update_feature(dataset: str, models: list[str] | None):
|
| 2481 |
dataset = dataset or DATASETS[0]
|
| 2482 |
validation_fig, table = feature_figures(dataset, models)
|
| 2483 |
+
_column, _target, metric, _reference = feature_spec(dataset)
|
| 2484 |
if dataset == "allen_neuropixels":
|
| 2485 |
definition = (
|
| 2486 |
+
"Spearman’s ρ measures association between feature-attribution values "
|
| 2487 |
+
"and each unit’s drifting-gratings orientation selectivity."
|
| 2488 |
)
|
| 2489 |
elif dataset == "ratinabox":
|
| 2490 |
definition = (
|
|
|
|
| 2496 |
"ROC-AUC measures whether recorded neural features rank above appended "
|
| 2497 |
"synthetic controls. Chance ROC-AUC is 0.5."
|
| 2498 |
)
|
| 2499 |
+
table_columns = column_defs(table.columns)
|
| 2500 |
+
for column in table_columns:
|
| 2501 |
+
if column["id"] == "validation_score":
|
| 2502 |
+
column["name"] = metric
|
| 2503 |
return (
|
| 2504 |
definition,
|
| 2505 |
validation_fig,
|
| 2506 |
feature_heatmap(models),
|
| 2507 |
+
table_columns,
|
| 2508 |
records(table),
|
| 2509 |
)
|
| 2510 |
|