Portfolio Details
Ride-hailing analytics and fee prediction on Algerian trip data
Interactive dashboard
Project information
- Category: Data Science / Machine Learning
- Stack: Python, Pandas, Plotly, LightGBM, CatBoost, Scikit-learn, Folium
- Project date: July 2026
- Live dashboard
- Source code: GitHub repo
Ride-hailing fee prediction & trip analytics
An end-to-end analysis of an Algerian ride-hailing dataset, covering exploratory data analysis, rider and driver behavior patterns, and a fee prediction model. The project includes trip status breakdowns (finished vs not finished), seasonal and hourly demand patterns, geographic distribution of pickups across the top Algerian cities, and an interactive Folium map of driver-rider flows.
The final gradient-boosted model (LightGBM / CatBoost) predicts trip fees using distance, time, and city-level features. All exploratory charts are also available as a standalone interactive dashboard (embedded above), built with Chart.js and deployed via GitHub Pages.
Project deep dive
Problem statement
Given trip-level data — pickup/destination city, distances, timestamps,
rider/driver info, discounts, and cancellations — predict trip_fee
for unseen trips on an Algerian ride-hailing platform. Since the target is only
evaluated on completed trips, a large share of the work is understanding
why trips fail (cancellations, unaccepted requests) before ever touching
the regression problem itself.
Dataset
Trip records from a ride-hailing service operating across 47 Algerian cities:
- Timestamps: request, accepted, started, finished
- Trip info: pickup/destination city, trip distance, driver-to-rider distance, status
- People: rider, driver, rider/driver ratings
- Money: discounts,
trip_fee(target)
Missing values concentrate in trips never accepted, started, or completed — treated as structurally missing, not data errors.
Methodology
- Descriptive statistics — finished vs. unfinished trip rates by month, time of day, and city, to see where and when demand is lost.
- Exploratory analysis — K-Means customer segmentation on frequency, completion rate, cancellation rate, distance, and spend (4 rider profiles); driver-level KPIs; an interactive Folium map of demand, cancellation, and revenue flows between pickup/destination cities.
- Feature engineering — time features from the request timestamp, a same-city flag, trip duration with a missingness flag (some "FINISHED" trips had implausible sub-1-minute durations), discount imputation, and weather enrichment via the Open-Meteo archive API, batched on unique city/date pairs.
- Modeling — five regressors trained and compared on log-transformed fee: Random Forest, an ensemble average of XGBoost/LightGBM/CatBoost, LightGBM, CatBoost, XGBoost, plus a small feedforward neural network (Keras/TensorFlow) as a deep-learning baseline.
Key findings
| Model | MAE | RMSE | R² |
|---|---|---|---|
| Random Forest | 52.32 | 387.82 | 0.9496 |
| Ensemble (XGB/LGBM/CatBoost avg) | 53.85 | 435.19 | 0.9365 |
| LightGBM | 54.23 | 438.61 | 0.9355 |
| CatBoost | 54.91 | 419.35 | 0.9411 |
| XGBoost | 55.23 | 482.56 | 0.9219 |
| Deep Learning (MLP) | 106.74 | 1044.52 | 0.6342 |
Random Forest was selected for the final model on lowest MAE. The MLP baseline underperforming by a wide margin is itself a useful result: on this tabular, mixed-type feature set, tree ensembles capture the signal far more efficiently than a plain neural net.
Tech stack
Key insight: the highest-spending, highest-frequency rider segment also has the worst completion rate — a retention risk sitting on top of the platform's best revenue. See the GitHub repo →