Create Training Congestion Prediction Model
Browse files
Training Congestion Prediction Model
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# train_congestion_model.py
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from sklearn.ensemble import RandomForestClassifier
|
| 4 |
+
import joblib
|
| 5 |
+
|
| 6 |
+
df = pd.read_csv("location_logs.csv")
|
| 7 |
+
X = df[['hour', 'day_of_week', 'location_id']]
|
| 8 |
+
y = df['is_congested']
|
| 9 |
+
|
| 10 |
+
model = RandomForestClassifier()
|
| 11 |
+
model.fit(X, y)
|
| 12 |
+
|
| 13 |
+
joblib.dump(model, 'congestion_model.pkl')
|