Which shipments
come back?
Shipment return risk predictor
Machine learning · PostExA return is more than a failed delivery. I built a LightGBM system with two stages to predict shipment returns at checkout and after ordering.
Customer history, merchant return rates, address quality, and order channel inform a risk score for each shipment, grouped into actionable tiers.
- 0.92ROC-AUC
- 0.91PR-AUC
- 0.02Calibration error
- 93%Precision at 50% recall
Stage 2 results on a separate test set. Launch thresholds cleared.
Inside the system
Model at checkout: 17 features. Model after ordering: 47 features. Both use isotonic calibration. Stage 1 reached 0.90 ROC-AUC and 0.85 PR-AUC.
Engineered five feature layers: order, customer, H3 geospatial, network/graph, and temporal. Added Optuna tuning, SHAP reason codes, and promotion gates that compare retrained candidates with the current model.
Served both models through a Flask REST API with Docker and pytest. Audited explanations and fixed SHAP wording that contradicted feature values in 26% of reasons.
Python / LightGBM / Optuna / SHAP / Flask / Docker / pytest