Spaces:
Running
Running
Create utils/preprocessing.py
Browse files- utils/preprocessing.py +11 -0
utils/preprocessing.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def extract_features(agent_data):
|
| 2 |
+
"""
|
| 3 |
+
Convert input JSON into numerical features for Isolation Forest.
|
| 4 |
+
Order: weekly_calls, missed_visits, travel_distance, lead_drop_rate
|
| 5 |
+
"""
|
| 6 |
+
return [
|
| 7 |
+
agent_data.get("weekly_calls", 0),
|
| 8 |
+
agent_data.get("missed_visits", 0),
|
| 9 |
+
agent_data.get("travel_distance", 0),
|
| 10 |
+
agent_data.get("lead_drop_rate", 0.0)
|
| 11 |
+
]
|