
At a glance: Python, pandas, scikit-learn, SMOTE · shipment lifecycle data (transport metrics, port congestion, inventory, weather, supplier reliability, driver behavior) · Random Forest vs. Gradient Boosting on a stratified 80/20 split · best result: Gradient Boosting with 73.9% accuracy, 0.849 F1, and 98.5% recall.
The business problem.
Every late shipment, congested port, and misplaced pallet costs money. Operations teams usually react after a disruption. The question I set out to answer: can the logistics data companies already collect predict disruptions before they happen?
The data.
I worked with shipment lifecycle records covering transportation metrics and arrival-time variance, traffic and port congestion, inventory levels and warehouse handling times, weather conditions, supplier reliability and lead times, driver behavior and fatigue, shipping costs, and fulfillment status. On top of the raw fields, I engineered congestion scores, driver performance indices, supply chain stress indicators, and operational efficiency metrics.
The approach.
Missing values handled with median imputation and numerical features scaled with StandardScaler. Class imbalance addressed with SMOTE so the minority disruption class is properly learned. A stratified 80/20 train-test split kept class ratios honest. Then two models, head to head: Random Forest vs. Gradient Boosting, judged on accuracy, precision, recall, F1, and ROC-AUC.
The results.
Gradient Boosting wins on accuracy (73.87%), recall (98.52%), and F1 (0.849) against Random Forest's 66.71% accuracy and 0.788 F1. That 98.5% recall matters most: it catches nearly every disruption, and in operations a miss costs more than a false alarm.
Both ROC-AUC scores sit near 0.50 — the models flag disruptions well but discriminate weakly across thresholds. That is a model that needs more feature work before it goes near production, and knowing where a model isn't ready is part of the job.
What it is good for.
Early warning: high-recall flagging lets ops teams intervene on at-risk shipments before failure. Smarter routing: risk scores feed alternative-routing decisions. Inventory planning: reliability signals inform safety-stock levels per lane and supplier. Supplier scorecards: modeled reliability beats gut feel when renegotiating contracts.
What is next.
Baseline-model comparison, hyperparameter tuning, calibration checks, and richer time-based features. Then the honest question again: does it actually beat a simple rule-based flag?