File size: 1,843 Bytes
012f0e6 8e63613 012f0e6 a94c99e 012f0e6 a94c99e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 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") |