Update app.py
Browse files
app.py
CHANGED
|
@@ -399,13 +399,13 @@ elif st.session_state.current_page == "EDA":
|
|
| 399 |
|
| 400 |
# Model Building
|
| 401 |
elif st.session_state.current_page == "Model Building":
|
| 402 |
-
|
| 403 |
-
st.markdown("<hr style='border:1px solid #ddd;'>", unsafe_allow_html=True)
|
| 404 |
|
| 405 |
st.markdown("""
|
| 406 |
<h2 style='text-align: center; color: #333;'>Model Building</h2>
|
| 407 |
""", unsafe_allow_html=True)
|
| 408 |
|
|
|
|
|
|
|
| 409 |
st.markdown("""
|
| 410 |
<h2>Introduction</h2>
|
| 411 |
<p>In this section, we explore different <b>Ensemble Learning</b> techniques to improve model performance.</p>
|
|
@@ -446,7 +446,7 @@ elif st.session_state.current_page == "Model Building":
|
|
| 446 |
st.markdown("<hr style='border:1px solid #ddd;'>", unsafe_allow_html=True)
|
| 447 |
|
| 448 |
st.markdown("""
|
| 449 |
-
<
|
| 450 |
<p>A crucial step to improve ensemble performance is <b>choosing models with different variance levels</b>:</p>
|
| 451 |
<ul>
|
| 452 |
<li><b>Voting Regressor:</b> Uses a combination of <b>high-variance</b> (Decision Tree, KNN with small K) and <b>low-variance</b> (KNN with large K, Decision Tree with depth constraint) models.</li>
|
|
@@ -459,7 +459,7 @@ elif st.session_state.current_page == "Model Building":
|
|
| 459 |
|
| 460 |
# Hyperparameter Tuning
|
| 461 |
st.markdown("""
|
| 462 |
-
<
|
| 463 |
<p>We optimized hyperparameters for <b>KNN, Decision Tree, Bagging Regressor, and Random Forest</b> using <b>Optuna</b>.</p>
|
| 464 |
<p>Below are the <b>optimized parameters</b> for each model:</p>
|
| 465 |
|
|
@@ -482,14 +482,14 @@ elif st.session_state.current_page == "Model Building":
|
|
| 482 |
|
| 483 |
<h5>πΉ Bagging Regressor</h5>
|
| 484 |
<ul>
|
| 485 |
-
<li><code>n_estimators</code
|
| 486 |
-
<li><code>max_samples</code
|
| 487 |
</ul>
|
| 488 |
|
| 489 |
<h5>πΉ Random Forest</h5>
|
| 490 |
<ul>
|
| 491 |
-
<li><code>n_estimators</code
|
| 492 |
-
<li><code>max_samples</code
|
| 493 |
</ul>
|
| 494 |
""", unsafe_allow_html=True)
|
| 495 |
|
|
@@ -497,7 +497,7 @@ elif st.session_state.current_page == "Model Building":
|
|
| 497 |
|
| 498 |
# Model Performance Insights
|
| 499 |
st.markdown("""
|
| 500 |
-
<
|
| 501 |
<p>Hereβs how our ensemble models performed on training and test datasets:</p>
|
| 502 |
""", unsafe_allow_html=True)
|
| 503 |
|
|
@@ -537,13 +537,13 @@ elif st.session_state.current_page == "Model Building":
|
|
| 537 |
<td>Bagging Ensemble</td>
|
| 538 |
<td>98.68%</td>
|
| 539 |
<td>95.04%</td>
|
| 540 |
-
<td>95.45%</td>
|
| 541 |
</tr>
|
| 542 |
<tr>
|
| 543 |
<td>Random Forest</td>
|
| 544 |
<td>97.92%</td>
|
| 545 |
<td>94.71%</td>
|
| 546 |
-
<td
|
| 547 |
</tr>
|
| 548 |
</table>
|
| 549 |
""", unsafe_allow_html=True)
|
|
@@ -561,8 +561,10 @@ elif st.session_state.current_page == "Model Building":
|
|
| 561 |
<p><b>β
Final Choice:</b> <span style='color: #FF6D28;'>Bagging Ensemble</span> due to its strong generalization ability! π</p>
|
| 562 |
""", unsafe_allow_html=True)
|
| 563 |
|
|
|
|
|
|
|
|
|
|
| 564 |
|
| 565 |
-
|
| 566 |
# Hands-on Model Page
|
| 567 |
elif st.session_state.current_page == "Hands-on Model":
|
| 568 |
st.title("Hands-on Model")
|
|
|
|
| 399 |
|
| 400 |
# Model Building
|
| 401 |
elif st.session_state.current_page == "Model Building":
|
|
|
|
|
|
|
| 402 |
|
| 403 |
st.markdown("""
|
| 404 |
<h2 style='text-align: center; color: #333;'>Model Building</h2>
|
| 405 |
""", unsafe_allow_html=True)
|
| 406 |
|
| 407 |
+
st.markdown("<hr style='border:1px solid #ddd;'>", unsafe_allow_html=True)
|
| 408 |
+
|
| 409 |
st.markdown("""
|
| 410 |
<h2>Introduction</h2>
|
| 411 |
<p>In this section, we explore different <b>Ensemble Learning</b> techniques to improve model performance.</p>
|
|
|
|
| 446 |
st.markdown("<hr style='border:1px solid #ddd;'>", unsafe_allow_html=True)
|
| 447 |
|
| 448 |
st.markdown("""
|
| 449 |
+
<h3>Combining High & Low Variance Models</h3>
|
| 450 |
<p>A crucial step to improve ensemble performance is <b>choosing models with different variance levels</b>:</p>
|
| 451 |
<ul>
|
| 452 |
<li><b>Voting Regressor:</b> Uses a combination of <b>high-variance</b> (Decision Tree, KNN with small K) and <b>low-variance</b> (KNN with large K, Decision Tree with depth constraint) models.</li>
|
|
|
|
| 459 |
|
| 460 |
# Hyperparameter Tuning
|
| 461 |
st.markdown("""
|
| 462 |
+
<h3>Hyperparameter Tuning using Optuna β‘</h3>
|
| 463 |
<p>We optimized hyperparameters for <b>KNN, Decision Tree, Bagging Regressor, and Random Forest</b> using <b>Optuna</b>.</p>
|
| 464 |
<p>Below are the <b>optimized parameters</b> for each model:</p>
|
| 465 |
|
|
|
|
| 482 |
|
| 483 |
<h5>πΉ Bagging Regressor</h5>
|
| 484 |
<ul>
|
| 485 |
+
<li><code>n_estimators</code></li>
|
| 486 |
+
<li><code>max_samples</code></li>
|
| 487 |
</ul>
|
| 488 |
|
| 489 |
<h5>πΉ Random Forest</h5>
|
| 490 |
<ul>
|
| 491 |
+
<li><code>n_estimators</code></li>
|
| 492 |
+
<li><code>max_samples</code></li>
|
| 493 |
</ul>
|
| 494 |
""", unsafe_allow_html=True)
|
| 495 |
|
|
|
|
| 497 |
|
| 498 |
# Model Performance Insights
|
| 499 |
st.markdown("""
|
| 500 |
+
<h3>Model Performance Insights π</h3>
|
| 501 |
<p>Hereβs how our ensemble models performed on training and test datasets:</p>
|
| 502 |
""", unsafe_allow_html=True)
|
| 503 |
|
|
|
|
| 537 |
<td>Bagging Ensemble</td>
|
| 538 |
<td>98.68%</td>
|
| 539 |
<td>95.04%</td>
|
| 540 |
+
<td><b>95.45%</b></td>
|
| 541 |
</tr>
|
| 542 |
<tr>
|
| 543 |
<td>Random Forest</td>
|
| 544 |
<td>97.92%</td>
|
| 545 |
<td>94.71%</td>
|
| 546 |
+
<td>94.71%</td>
|
| 547 |
</tr>
|
| 548 |
</table>
|
| 549 |
""", unsafe_allow_html=True)
|
|
|
|
| 561 |
<p><b>β
Final Choice:</b> <span style='color: #FF6D28;'>Bagging Ensemble</span> due to its strong generalization ability! π</p>
|
| 562 |
""", unsafe_allow_html=True)
|
| 563 |
|
| 564 |
+
if st.button("π Go Back to Model Report"):
|
| 565 |
+
switch_page("Model Report")
|
| 566 |
+
|
| 567 |
|
|
|
|
| 568 |
# Hands-on Model Page
|
| 569 |
elif st.session_state.current_page == "Hands-on Model":
|
| 570 |
st.title("Hands-on Model")
|