Portfolio Details

Ride-hailing analytics and fee prediction on Algerian trip data

Interactive dashboard

Open dashboard in full screen

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

  1. Descriptive statistics — finished vs. unfinished trip rates by month, time of day, and city, to see where and when demand is lost.
  2. 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.
  3. 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.
  4. 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

ModelMAERMSE
Random Forest52.32387.820.9496
Ensemble (XGB/LGBM/CatBoost avg)53.85435.190.9365
LightGBM54.23438.610.9355
CatBoost54.91419.350.9411
XGBoost55.23482.560.9219
Deep Learning (MLP)106.741044.520.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

Python pandas scikit-learn XGBoost LightGBM CatBoost TensorFlow/Keras Folium Plotly geopy

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 →