Update app.py
Browse files
app.py
CHANGED
|
@@ -268,6 +268,48 @@ with tab2:
|
|
| 268 |
st.info("💡 Insight: Weather conditions appear stable. The forecast is primarily driven by seasonal trends and recent temperature history.")
|
| 269 |
# --- KẾT THÚC NÂNG CẤP ---
|
| 270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
# --- BIỂU ĐỒ DỮ LIỆU TRAINING ---
|
| 272 |
st.subheader("Training Set Overview")
|
| 273 |
with st.expander("Show plot of all training data (before 2024-02-18)"):
|
|
|
|
| 268 |
st.info("💡 Insight: Weather conditions appear stable. The forecast is primarily driven by seasonal trends and recent temperature history.")
|
| 269 |
# --- KẾT THÚC NÂNG CẤP ---
|
| 270 |
|
| 271 |
+
# --- NÂNG CẤP MỚI: Thêm "Feature Inspector" ---
|
| 272 |
+
st.markdown("---") # Thêm đường kẻ ngang
|
| 273 |
+
|
| 274 |
+
with st.expander("🔍 Feature Inspector: What the Model Saw on this Day"):
|
| 275 |
+
|
| 276 |
+
if not input_features.empty:
|
| 277 |
+
# Chúng ta sẽ hiển thị các tính năng trong các cột có tổ chức
|
| 278 |
+
col1, col2, col3 = st.columns(3)
|
| 279 |
+
|
| 280 |
+
# --- Cột 1: Core Weather & Persistence ---
|
| 281 |
+
with col1:
|
| 282 |
+
st.subheader("Core Conditions")
|
| 283 |
+
st.metric(label="Today's Avg Temp (temp)", value=f"{input_features['temp'].iloc[0]:.1f}°C")
|
| 284 |
+
st.metric(label="Today's 'Feels Like' (feelslike)", value=f"{input_features['feelslike'].iloc[0]:.1f}°C")
|
| 285 |
+
st.metric(label="Humidity", value=f"{input_features['humidity'].iloc[0]:.1f}%")
|
| 286 |
+
st.metric(label="Cloud Cover", value=f"{input_features['cloudcover'].iloc[0]:.1f}%")
|
| 287 |
+
st.metric(label="Precipitation", value=f"{input_features['precip'].iloc[0]:.1f} mm")
|
| 288 |
+
|
| 289 |
+
# --- Cột 2: Recent History (Lags & Rolling Windows) ---
|
| 290 |
+
with col2:
|
| 291 |
+
st.subheader("Recent History")
|
| 292 |
+
st.metric(label="Temp Yesterday (temp_lag_1)", value=f"{input_features['temp_lag_1'].iloc[0]:.1f}°C")
|
| 293 |
+
st.metric(label="7-Day Avg Temp (temp_roll_7d_mean)", value=f"{input_features['temp_roll_7d_mean'].iloc[0]:.1f}°C")
|
| 294 |
+
|
| 295 |
+
# --- ĐÃ SỬA LỖI ---
|
| 296 |
+
# Thay thế 'precip_roll_7d_sum' (không tồn tại) bằng 'precip_roll_7d_mean' (tồn tại)
|
| 297 |
+
st.metric(label="7-Day Avg Rainfall (precip_roll_7d_mean)", value=f"{input_features['precip_roll_7d_mean'].iloc[0]:.1f} mm")
|
| 298 |
+
|
| 299 |
+
st.metric(label="14-Day Temp Volatility (temp_roll_14d_std)", value=f"{input_features['temp_roll_14d_std'].iloc[0]:.2f}°C")
|
| 300 |
+
|
| 301 |
+
# --- Cột 3: Seasonal & Atmospheric Context ---
|
| 302 |
+
with col3:
|
| 303 |
+
st.subheader("Seasonal Context")
|
| 304 |
+
st.metric(label="Day of Year", value=f"{input_features['day_of_year'].iloc[0]}")
|
| 305 |
+
st.metric(label="Sea Level Pressure", value=f"{input_features['sealevelpressure'].iloc[0]:.1f} hPa")
|
| 306 |
+
st.metric(label="Wind Speed", value=f"{input_features['windspeed'].iloc[0]:.1f} km/h")
|
| 307 |
+
st.metric(label="Wind Direction", value=f"{input_features['winddir'].iloc[0]:.0f}°")
|
| 308 |
+
|
| 309 |
+
else:
|
| 310 |
+
st.warning("No feature data available for the selected date.")
|
| 311 |
+
# --- KẾT THÚC NÂNG CẤP "Feature Inspector" ---
|
| 312 |
+
|
| 313 |
# --- BIỂU ĐỒ DỮ LIỆU TRAINING ---
|
| 314 |
st.subheader("Training Set Overview")
|
| 315 |
with st.expander("Show plot of all training data (before 2024-02-18)"):
|