odunbar's picture
Improve the taxonomy of the methods (#8)
3d60772
Raw
History Blame
3.2 kB
from pathlib import Path
import sys
import streamlit as st
try:
from data_store import load_metric_store
except ModuleNotFoundError:
sys.path.append(str(Path(__file__).resolve().parents[1]))
from data_store import load_metric_store
st.set_page_config(page_title="Raw Data", page_icon="🧾", layout="wide")
# Sidebar navigation
st.sidebar.title("Navigation")
st.sidebar.page_link("streamlit_app.py", label="Home", icon="🏠")
st.sidebar.page_link("pages/OptimizationLeaderboard.py", label="Optimization Leaderboard", icon="πŸ“Š")
st.sidebar.page_link("pages/UQLeaderboard.py", label="UQ Leaderboard", icon="🎯")
st.sidebar.page_link("pages/MethodDetails.py", label="Methods", icon="πŸ“˜")
st.sidebar.page_link("pages/RawData.py", label="Get Data", icon="🧾")
st.title("Raw Averaged Forward Model Runs")
st.caption("All rows are averaged over random seeds during ingestion; `metric` represents forward model runs")
metric_store = load_metric_store()
if metric_store.empty:
st.warning("No metric data found. Expected NetCDF files in `data/` with a `metric` variable.")
st.stop()
benchmark_options = sorted(metric_store["benchmark"].unique().tolist())
default_benchmark_index = benchmark_options.index("L63") if "L63" in benchmark_options else 0
selected_benchmark = str(st.selectbox("Benchmark", options=benchmark_options, index=default_benchmark_index))
filtered = metric_store[metric_store["benchmark"] == selected_benchmark].copy()
filtered = filtered.sort_values(["abbreviation", "rmse_target", "ensemble_size"])
st.dataframe(
filtered[
[
"benchmark",
"abbreviation",
"Method",
"parallelism",
"update_type",
"method_goal",
"emulator_use",
"algorithm_type",
"algorithm_alias",
"rmse_target",
"ensemble_size",
"metric",
]
],
hide_index=True,
use_container_width=True,
column_config={
"benchmark": st.column_config.TextColumn("Benchmark"),
"abbreviation": st.column_config.TextColumn("Abbrev."),
"Method": st.column_config.TextColumn("Method"),
"parallelism": st.column_config.TextColumn("Parallelism"),
"update_type": st.column_config.TextColumn("Update Type"),
"method_goal": st.column_config.TextColumn("Method Goal"),
"emulator_use": st.column_config.TextColumn("Emulator Use"),
"algorithm_type": st.column_config.TextColumn("Canonical Type"),
"algorithm_alias": st.column_config.TextColumn("Source Alias"),
"rmse_target": st.column_config.TextColumn("RMSE Target"),
"ensemble_size": st.column_config.NumberColumn("Ensemble Size"),
"metric": st.column_config.NumberColumn("Mean Forward Model Runs", format="%.6f"),
},
)
csv_data = filtered.to_csv(index=False).encode("utf-8")
st.download_button(
label=f"Download {selected_benchmark} averaged metrics (CSV)",
data=csv_data,
file_name=f"{selected_benchmark.lower()}_averaged_metrics.csv",
mime="text/csv",
)
st.page_link("pages/OptimizationLeaderboard.py", label="β¬… Back to Optimization Leaderboard", icon="↩️")