Create pages/4 Feature Engineering.py
Browse files
pages/4 Feature Engineering.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Page Title
|
4 |
+
st.title("🛠️ Feature Engineering & Feature Selection")
|
5 |
+
|
6 |
+
# Feature Engineering Section
|
7 |
+
st.markdown("""
|
8 |
+
### ✨ Feature Engineering:
|
9 |
+
Several transformations were applied to prepare the dataset for modeling:
|
10 |
+
|
11 |
+
- **Encoding**: Used **Ordinal Encoding** to convert categorical variables like Gender, Sleep Duration, and Dietary Habits into numerical values.
|
12 |
+
- **Scaling**: Applied **StandardScaler** to normalize numerical features such as CGPA, Age, and Schedule Pressure.
|
13 |
+
- **Data Cleaning**: Removed irrelevant or noisy columns that did not contribute to the prediction task.
|
14 |
+
- **Balancing**: Checked for class imbalance in the target (`Depression`) to ensure proper model generalization.
|
15 |
+
""")
|
16 |
+
|
17 |
+
# Selected Features Section
|
18 |
+
st.markdown("""
|
19 |
+
### ✅ Selected Features:
|
20 |
+
The following features were retained for training the model based on correlation analysis and domain relevance:
|
21 |
+
|
22 |
+
- Gender
|
23 |
+
- Age
|
24 |
+
- Academic Pressure
|
25 |
+
- Study Satisfaction
|
26 |
+
- Sleep Duration
|
27 |
+
- Dietary Habits
|
28 |
+
- Financial Stress
|
29 |
+
- CGPA
|
30 |
+
- Schedule Pressure
|
31 |
+
- Integration Complexity
|
32 |
+
""")
|
33 |
+
|
34 |
+
# Dropped Features Section
|
35 |
+
st.markdown("""
|
36 |
+
### 🚫 Dropped Features:
|
37 |
+
- Redundant or low-impact features such as `Job Satisfaction`, `Profession`, and `City`
|
38 |
+
- Highly correlated features that introduced multicollinearity
|
39 |
+
|
40 |
+
The refined dataset was then used to train the **KNN classifier** for depression prediction.
|
41 |
+
""")
|
42 |
+
|
43 |
+
if st.button("Next >>"):
|
44 |
+
st.switch_page(r"pages\5 Model Building.py")
|
45 |
+
|
46 |
+
if st.button("<< Back"):
|
47 |
+
st.switch_page(r"pages\3 EDA.py")
|