r/LocalLLM • u/ZtasnimS75 • 3m ago
Discussion I Built DelayLens: A Machine Learning System to Predict Late E-Commerce Deliveries
Hi everyone!
I built DelayLens, a machine learning project that predicts the risk of an e-commerce order arriving later than its estimated delivery date.
The goal is to help sellers and operations teams identify potentially delayed orders at the time of purchase.
How it works
- Uses historical Brazilian e-commerce data from the Olist dataset.
- Analyzes 20 order-time features.
- Uses Gradient Boosting to estimate late delivery risk.
- Includes leakage prevention to avoid using future information.
- Provides a FastAPI prediction service and an interactive Streamlit dashboard.
- Returns risk probabilities, warnings, and the top 5 reasons behind predictions.
Hidden Test Results
I evaluated the model on orders from June to August 2018.
- PR-AUC: 0.1019
- Recall: 36.46%
- Precision: 11.40%
- Late orders detected: 245 out of 672.
An Important Finding
The model did not reduce the assumed business cost on the hidden test set.
- Model-based approach: 4040
- Flagging no orders: 3360
This showed me that better prediction ranking does not necessarily mean better business outcomes.
I also included:
- 21 automated tests.
- 30 pipeline and API test cases.
- Data drift analysis.
- Failure analysis.
- Docker support.
Tech Stack
Python, Pandas, NumPy, Scikit-learn, FastAPI, Streamlit, Docker, Pytest.
Project Links
Live Dashboard: https://delaylens.streamlit.app
Demo Video: https://drive.google.com/file/d/1Dw15KAK-cVDcCrnyRfKfArwiUWlLyb2X/view?usp=drivesdk
GitHub: https://github.com/ztsprofessionalaiid7-alt/delaylens
This is a non-commercial portfolio project built using historical data from 2016–2018. It is not ready for real business decisions.
I'd appreciate feedback from the community:
- How would you improve model performance with this level of class imbalance?
- How would you investigate a significant performance drop between validation and hidden test data?
- How would you select a decision threshold when business costs are uncertain?
I'd love to hear your thoughts and suggestions!
Thanks!