Spaces:
Runtime error
Runtime error
updated files and minor adjustments to ui
Browse files
app.py
CHANGED
|
@@ -550,7 +550,7 @@ if predict_clicked or "prediction" in st.session_state:
|
|
| 550 |
m1, m2, m3 = st.columns(3)
|
| 551 |
m1.metric("Grid Position", f"P{p['grid']}")
|
| 552 |
m2.metric("Team", p["constructor"])
|
| 553 |
-
m3.metric("
|
| 554 |
|
| 555 |
st.markdown("<div style='margin-top:1.2rem'></div>", unsafe_allow_html=True)
|
| 556 |
st.markdown("### Class Probabilities")
|
|
@@ -558,6 +558,18 @@ if predict_clicked or "prediction" in st.session_state:
|
|
| 558 |
proba_df = pd.DataFrame({"Probability": p["proba"]}, index=class_names)
|
| 559 |
st.bar_chart(proba_df, color="#E10600")
|
| 560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
st.divider()
|
| 562 |
st.markdown("### Race Analysis")
|
| 563 |
|
|
@@ -608,8 +620,15 @@ if predict_clicked or "prediction" in st.session_state:
|
|
| 608 |
st.markdown("<div style='margin-top:2rem'></div>", unsafe_allow_html=True)
|
| 609 |
with st.expander("Model Details"):
|
| 610 |
st.markdown(f"**Best Model:** {metadata['best_model_name']}")
|
| 611 |
-
st.markdown("**
|
|
|
|
| 612 |
for name, r in metadata["results"].items():
|
| 613 |
-
val
|
| 614 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
st.markdown(f"**Features ({len(feature_cols)}):** {', '.join(feature_cols)}")
|
|
|
|
| 550 |
m1, m2, m3 = st.columns(3)
|
| 551 |
m1.metric("Grid Position", f"P{p['grid']}")
|
| 552 |
m2.metric("Team", p["constructor"])
|
| 553 |
+
m3.metric("Data Range", f"{min_season} – {latest_season}")
|
| 554 |
|
| 555 |
st.markdown("<div style='margin-top:1.2rem'></div>", unsafe_allow_html=True)
|
| 556 |
st.markdown("### Class Probabilities")
|
|
|
|
| 558 |
proba_df = pd.DataFrame({"Probability": p["proba"]}, index=class_names)
|
| 559 |
st.bar_chart(proba_df, color="#E10600")
|
| 560 |
|
| 561 |
+
_label_colors = {"Gained": "#00C853", "Held": "#FFFFFF", "Lost": "#E10600"}
|
| 562 |
+
prob_cols = st.columns(len(class_names))
|
| 563 |
+
for col, name, prob in zip(prob_cols, class_names, p["proba"]):
|
| 564 |
+
color = _label_colors.get(name, "#FFFFFF")
|
| 565 |
+
col.markdown(
|
| 566 |
+
f"<div style='text-align:center;'>"
|
| 567 |
+
f"<div style='color:#555;font-size:0.68rem;letter-spacing:0.12em;text-transform:uppercase;font-weight:600;'>{name}</div>"
|
| 568 |
+
f"<div style='color:{color};font-size:1.4rem;font-weight:700;'>{prob:.0%}</div>"
|
| 569 |
+
f"</div>",
|
| 570 |
+
unsafe_allow_html=True,
|
| 571 |
+
)
|
| 572 |
+
|
| 573 |
st.divider()
|
| 574 |
st.markdown("### Race Analysis")
|
| 575 |
|
|
|
|
| 620 |
st.markdown("<div style='margin-top:2rem'></div>", unsafe_allow_html=True)
|
| 621 |
with st.expander("Model Details"):
|
| 622 |
st.markdown(f"**Best Model:** {metadata['best_model_name']}")
|
| 623 |
+
st.markdown(f"**Splits:** Train {metadata['train_seasons']} · Val {metadata['val_seasons']} · Test {metadata['test_seasons']}")
|
| 624 |
+
st.markdown("**Model Comparison:**")
|
| 625 |
for name, r in metadata["results"].items():
|
| 626 |
+
val = r.get("val_2024", {})
|
| 627 |
+
test = r.get("test_2025", {})
|
| 628 |
+
marker = " ✓" if name == metadata["best_model_name"] else ""
|
| 629 |
+
st.markdown(
|
| 630 |
+
f"- **{name}{marker}** — "
|
| 631 |
+
f"Val 2024: Acc={val.get('accuracy', 0):.3f}, F1={val.get('f1_weighted', 0):.3f} · "
|
| 632 |
+
f"Test 2025: Acc={test.get('accuracy', 0):.3f}, F1={test.get('f1_weighted', 0):.3f}"
|
| 633 |
+
)
|
| 634 |
st.markdown(f"**Features ({len(feature_cols)}):** {', '.join(feature_cols)}")
|