Ride-hailing analytics on Algerian trip data — rider segmentation, driver KPIs, interactive geo map, and fee prediction
# **Ride-Hailing Trip Fee Prediction**
Predicting trip fees for an Algerian ride-hailing platform using historical trip, driver, rider and weather data. Built as an end-to-end data science project: EDA → customer segmentation → geospatial analysis → feature engineering → ML modeling.
## Problem
Given trip-level data (pickup/destination city, distances, timestamps, rider/driver info, discounts, cancellations), predict `trip_fee` for unseen trips. The target is evaluated on completed trips only, so a large share of the work is understanding *why* trips fail (cancellations, unaccepted requests) before ever touching the regression problem.
## Dataset
Trip records from a ride-hailing service operating in 47 Algerian cities. Each row is one trip request with:
- Timestamps: `request_date`, `accepted_date`, `started_date`, `trip_finished_date`
- Trip info: `pickup_city`, `destination_city`, `trip_distance`, `driver2rider_distance`, `trip_status`
- People: `rider`, `driver`, `rider_rating`, `driver_rating`
- Money: `used_discount`, `discount_amount`, `trip_fee` (target)
- Cancellation reasons (rider/driver side)
Missing values are concentrated in trips that were never accepted, started, or completed (driver info, ratings, fees) — these are treated as **structurally missing**, not data errors, and handled accordingly rather than dropped.
## Approach
**1. Descriptive statistics** — finished vs. unfinished trip rates broken down by month, time of day, and city, to understand where and when demand is lost.
**2. Exploratory data analysis**
- *Customer segmentation* (K-Means on frequency, completion rate, cancellation rate, distance, spend) → 4 rider profiles. The key finding: the highest-spending, highest-frequency segment also has the worst completion rate — a retention risk sitting on top of the platform's best revenue.
- *Driver-level KPIs*
- *Interactive geographic analysis* (Folium) mapping demand, cancellation, and revenue flows between pickup/destination cities …