ProjectRiskLevelClassification / pages /5 Model Building.py
Srikanthgoud7's picture
Update pages/5 Model Building.py
8e63613 verified
Raw
History Blame Contribute Delete
1.84 kB
import streamlit as st
# βš™οΈ Model Building & Evaluation
st.markdown("""
## βš™οΈ Model Building & Evaluation
### πŸ—οΈ Model Building:
The classification model was built using the **KNN Classifier**, a robust ensemble learning method suitable for handling both numerical and categorical data.
**Model Pipeline:**
- **Preprocessing**:
- Applied **ColumnTransformer** to handle both categorical and numerical features.
- Used **StandardScaler** for scaling continuous variables.
- Encoded categorical columns using **OrdinalEncoder** (where appropriate).
- **Model**:
- Trained using **KNearestNeighbors Classifier** from `scikit-learn` with tuned hyperparameters.
---
### βœ… Model Training:
- The dataset was split into **training and testing sets** using an 80-20 split.
- The model was trained on the training set using the engineered features.
- Proper cross-validation techniques were used to avoid overfitting.
---
### πŸ“Š Model Evaluation:
**Evaluation Metrics Used:**
- **Accuracy** – Measures the overall correctness of the model.
- **Precision** – Measures how many predicted "High Risk" projects were actually high risk.
- **Recall** – Indicates how many actual high-risk projects were correctly identified.
- **F1 Score** – Harmonic mean of precision and recall for balanced performance.
- **Confusion Matrix** – Visual breakdown of correct and incorrect classifications.
---
The model demonstrated **strong classification performance** on the test dataset, achieving good scores across all metrics.
It was then saved as a **.pkl** file for deployment and integrated into the Streamlit app for real-time predictions.
""")
if st.button('Go to Deployment'):
st.switch_page("pages/6 Deployment.py")
if st.button('Back'):
st.switch_page("pages/4 Feature Engineering.py")