import streamlit as st | |
# Page Title | |
st.title("βοΈ Model Building & Evaluation") | |
# Model Building Section | |
st.markdown(""" | |
### ποΈ Model Building: | |
The classification model was built using the **K-Nearest Neighbors (KNN) Classifier**, which predicts a student's depression status based on similar instances in the training data. | |
#### Model Pipeline: | |
- **Preprocessing**: Encoding and scaling were handled using `ColumnTransformer` with `OrdinalEncoder` and `StandardScaler`. | |
- **Train-Test Split**: The dataset was split into training and testing sets using `train_test_split` with **stratification** on the target to preserve class balance. | |
- **Model**: Implemented using `KNeighborsClassifier` from scikit-learn. | |
""") | |
# Model Training Section | |
st.markdown(""" | |
### β Model Training: | |
- The model was trained on the processed dataset with optimized hyperparameters. | |
- `GridSearchCV` was used to find the best value of `k` (number of neighbors). | |
- Cross-validation ensured the robustness of the trained model. | |
""") | |
# Model Evaluation Section | |
st.markdown(""" | |
### π Model Evaluation: | |
**Metrics Used:** | |
- Accuracy Score | |
- Classification Report (Precision, Recall, F1-score) | |
- Confusion Matrix | |
The trained model demonstrated good performance on the test data and was exported as a `.pkl` file for deployment in the Streamlit app. | |
""") | |
if st.button("Go to Deployment >>"): | |
st.switch_page(r"pages/6 Deployment.py") | |
if st.button("<< Back"): | |
st.switch_page(r"pages/4 Feature Engineering.py") |