Update app.py
Browse files
app.py
CHANGED
|
@@ -328,6 +328,74 @@ datac["Status"] = oe.fit_transform(datac[["Status"]])
|
|
| 328 |
if st.button("π Go Back to Model Report"):
|
| 329 |
switch_page("Model Report")
|
| 330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
|
| 332 |
# Hands-on Model Page
|
| 333 |
elif st.session_state.current_page == "Hands-on Model":
|
|
|
|
| 328 |
if st.button("π Go Back to Model Report"):
|
| 329 |
switch_page("Model Report")
|
| 330 |
|
| 331 |
+
elif st.session_state.current_page == "EDA":
|
| 332 |
+
st.markdown("<h1 class='title'>Exploratory Data Analysis (EDA)</h1>", unsafe_allow_html=True)
|
| 333 |
+
|
| 334 |
+
# Target Column Distribution
|
| 335 |
+
st.markdown("<h2 class='subtitle' style='text-align: center;'>Target Column Distribution</h2>", unsafe_allow_html=True)
|
| 336 |
+
st.image("images/life_expectancy_distribution.png", caption="Life Expectancy Distribution", use_container_width=True)
|
| 337 |
+
st.markdown("""
|
| 338 |
+
<h5 style="text-align: center;">
|
| 339 |
+
π Insight: Mostly Life Expectancy is in <b>range of 50-80</b>.
|
| 340 |
+
</h5>
|
| 341 |
+
""", unsafe_allow_html=True)
|
| 342 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 343 |
+
|
| 344 |
+
# Correlation Heatmap
|
| 345 |
+
st.markdown("<h2 class='subtitle' style='text-align: center;'>Correlation Heatmap</h2>", unsafe_allow_html=True)
|
| 346 |
+
st.image("images/correlation_heatmap.png", caption="Correlation Heatmap", use_container_width=True)
|
| 347 |
+
st.markdown("""
|
| 348 |
+
<h5 style="text-align: center;">
|
| 349 |
+
π Insight: Our target column <b>Life Expectancy</b> is mostly linearly dependent on
|
| 350 |
+
<b>Schooling, Income Composition of Resources, GDP, Diphtheria, Polio, BMI, and Percentage Expenditure</b>.
|
| 351 |
+
</h5>
|
| 352 |
+
""", unsafe_allow_html=True)
|
| 353 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 354 |
+
|
| 355 |
+
# How Specific Columns Affect Life Expectancy
|
| 356 |
+
st.markdown("<h2 class='subtitle' style='text-align: center;'>How Specific Columns Affect Life Expectancy</h2>", unsafe_allow_html=True)
|
| 357 |
+
|
| 358 |
+
# GDP vs. Life Expectancy
|
| 359 |
+
st.image("images/gdp_vs_life_expectancy.png", caption="GDP vs. Life Expectancy", use_container_width=True)
|
| 360 |
+
st.markdown("""
|
| 361 |
+
<h5>
|
| 362 |
+
π <b>Insights from the Above Graphs:</b>
|
| 363 |
+
1οΈβ£ **GDP vs. Life Expectancy**
|
| 364 |
+
- Positive correlation: As GDP increases, Life Expectancy also increases.
|
| 365 |
+
- Some countries with low GDP still have high Life Expectancy due to good healthcare policies.
|
| 366 |
+
|
| 367 |
+
2οΈβ£ **Schooling vs. Life Expectancy**
|
| 368 |
+
- Strong positive correlation: More years of schooling β longer life.
|
| 369 |
+
- Educated populations follow better hygiene, diet, and medical care, increasing Life Expectancy.
|
| 370 |
+
|
| 371 |
+
3οΈβ£ **Income Composition vs. Life Expectancy**
|
| 372 |
+
- Higher economic stability leads to better healthcare systems and lifestyles, improving Life Expectancy.
|
| 373 |
+
|
| 374 |
+
4οΈβ£ **Diphtheria & Polio vs. Life Expectancy**
|
| 375 |
+
- Higher vaccination rates (80%-100%) correspond to Life Expectancy above 70 years.
|
| 376 |
+
- Lower vaccination rates (<40%) lead to lower Life Expectancy (~40-60 years), indicating weak healthcare infrastructure.
|
| 377 |
+
|
| 378 |
+
5οΈβ£ **BMI vs. Life Expectancy**
|
| 379 |
+
- No clear linear trend due to high variance in data points.
|
| 380 |
+
- BMI < 18 (malnutrition) and BMI > 30 (obesity) reduce Life Expectancy.
|
| 381 |
+
- Advanced healthcare and better nutrition in some countries help maintain high Life Expectancy despite malnutrition/obesity.
|
| 382 |
+
</h5>
|
| 383 |
+
""", unsafe_allow_html=True)
|
| 384 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 385 |
+
|
| 386 |
+
# Life Expectancy vs Developed / Undeveloped Countries
|
| 387 |
+
st.image("images/life_expectancy_vs_developed.png", caption="Life Expectancy vs Developed / Undeveloped Countries", use_container_width=True)
|
| 388 |
+
st.markdown("""
|
| 389 |
+
<h5>
|
| 390 |
+
6οΈβ£ <b>Life Expectancy vs Developed / Undeveloped Countries</b>
|
| 391 |
+
- **Insight:** Life Expectancy is <b>higher in Developed Countries</b> due to:
|
| 392 |
+
- **Advanced Healthcare** π
|
| 393 |
+
- **Better Nutrition** π
|
| 394 |
+
- **Medical Interventions** π₯
|
| 395 |
+
- Developing countries, on the other hand, struggle with healthcare access, leading to lower Life Expectancy.
|
| 396 |
+
</h5>
|
| 397 |
+
""", unsafe_allow_html=True)
|
| 398 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 399 |
|
| 400 |
# Hands-on Model Page
|
| 401 |
elif st.session_state.current_page == "Hands-on Model":
|