File size: 1,522 Bytes
378d4ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dc70d4a
378d4ca
 
 
aed0310
378d4ca
 
aed0310
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
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")