Create pages/4 Feature Engineering.py
Browse files
pages/4 Feature Engineering.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# 🛠️ Feature Engineering & Feature Selection
|
| 4 |
+
st.markdown("""
|
| 5 |
+
## 🛠️ Feature Engineering & Feature Selection
|
| 6 |
+
|
| 7 |
+
### ✨ Feature Engineering:
|
| 8 |
+
|
| 9 |
+
To ensure the dataset was machine-learning ready, the following preprocessing steps were applied:
|
| 10 |
+
|
| 11 |
+
- **Encoding**:
|
| 12 |
+
- Categorical variables like `Project_Type`, `Methodology_Used`, `Team_Experience_Level`, and `Requirement_Stability` were converted into numerical format using **OrdinalEncoder**, depending on model compatibility.
|
| 13 |
+
|
| 14 |
+
- **Scaling**:
|
| 15 |
+
Continuous variables such as `Project_Budget_USD`, `Complexity_Score`, and `Current_Phase_Duration_Months` were normalized using **StandardScaler** to bring features to the same scale and improve model convergence.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
- **Feature Harmonization**:
|
| 19 |
+
- Ensured consistency in values across categorical variables, and handled any duplicates or anomalies.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
### ✅ Selected Features:
|
| 24 |
+
|
| 25 |
+
Following analysis and correlation review, these 11 features were selected for model training:
|
| 26 |
+
|
| 27 |
+
- `Project_Type`
|
| 28 |
+
- `Team_Size`
|
| 29 |
+
- `Project_Budget_USD`
|
| 30 |
+
- `Estimated_Timeline_Months`
|
| 31 |
+
- `Complexity_Score`
|
| 32 |
+
- `Stakeholder_Count`
|
| 33 |
+
- `Methodology_Used`
|
| 34 |
+
- `Team_Experience_Level`
|
| 35 |
+
- `External_Dependencies_Count`
|
| 36 |
+
- `Requirement_Stability`
|
| 37 |
+
- `Current_Phase_Duration_Months`
|
| 38 |
+
|
| 39 |
+
These features represent a strong balance between environmental, structural, and planning attributes of the project.
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
### 🚫 Dropped Features:
|
| 44 |
+
|
| 45 |
+
- `Unnamed: 0`: Index column without predictive significance
|
| 46 |
+
- `Past_Similar_Projects`: Removed due to data filtering and possible outliers
|
| 47 |
+
- `Resource_Availability`, `Technical_Debt_Level`, `Seasonal_Risk_Factor`: Removed during feature reduction (assumed from earlier steps)
|
| 48 |
+
|
| 49 |
+
The final feature set was used to train the **KNearestNeighbors Classifier**, enabling reliable classification of projects into **Low**, **Medium**, **High**,**Critical**.
|
| 50 |
+
""")
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
if st.button('Next'):
|
| 54 |
+
st.switch_page(r"pages\5.Model Building.py")
|
| 55 |
+
|
| 56 |
+
if st.button('Back'):
|
| 57 |
+
st.switch_page(r"pages\3.EDA.py")
|