Download pages/5_Model_Building.py from Srikanth0804/Flight_Price_Prediction: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/Srikanth0804/Flight_Price_Prediction/resolve/main/pages/5_Model_Building.py
- Command line
-
hf download hf://spaces/Srikanth0804/Flight_Price_Prediction/pages/5_Model_Building.py
-
curl -L -o 5_Model_Building.py https://huggingface.co/spaces/Srikanth0804/Flight_Price_Prediction/resolve/main/pages/5_Model_Building.py
1.25 kB
| import streamlit as st | |
| import pandas as pd | |
| st.title("⚙️ Model Building & Evaluation") | |
| st.markdown(""" | |
| ## 🏗️ Model Building: | |
| To determine the most effective model for predicting flight ticket prices, I experimented with multiple regression algorithms: | |
| - **Linear Regression** | |
| - **K-Nearest Neighbors (KNN)** | |
| - **Decision Tree Regressor** | |
| - **Random Forest Regressor** | |
| - **XGBoost Regressor** | |
| Each model was trained using the same preprocessed dataset and evaluated on test data to ensure a fair comparison. | |
| --- | |
| ## ✅ Model Training & Evaluation: | |
| The following metrics were used to evaluate model performance: | |
| - **Mean Absolute Error (MAE)** | |
| - **Root Mean Squared Error (RMSE)** | |
| - **R² Score** | |
| --- | |
| ## 🏆 Best Model Selection: | |
| Based on evaluation metrics: | |
| - **Random Forest Regressor** achieved the **highest R² score (0.98)** and the **lowest MAE and RMSE**, | |
| indicating it is the most accurate and consistent model for predicting flight prices. | |
| The final Random Forest model has been saved and is now ready for deployment in the next page. | |
| """) | |
| if st.button('Go to the Deployment Page'): | |
| st.switch_page('pages/6_Deployment.py') | |
| if st.button('Go to Feature Engineering'): | |
| st.switch_page('pages/4_Feature_Engineering.py') |