E-Commerce Customer Churn & LTV Dashboard
Streamlit dashboard that predicts customer churn and lifetime value from transaction logs.
2 min read
Predicts customer churn and Lifetime Value (LTV) from transaction logs and presents the results in an interactive Streamlit dashboard.
How it works
generate_data.pysimulates a 2-year transaction log for 2,000 customers (swap in a real orders export with the samecustomer_id, order_date, amountcolumns and everything downstream works unchanged).features.pybuilds RFM features (recency, frequency, monetary, tenure) from a 90-day-before-cutoff window, and derives labels from the 90 days after it:churned(no repeat purchase) andfuture_ltv(actual future spend).train.pyfits aGradientBoostingClassifier(churn) and aGradientBoostingRegressor(LTV) on the RFM features.app.pyis the Streamlit dashboard: churn-risk-vs-LTV scatter, an at-risk customer table, and feature importances.
Run it
pip install -r requirements.txt
python generate_data.py # writes data/transactions.csv
python train.py # writes models/*.joblib, prints AUC/MAE
streamlit run app.py
python test_pipeline.py # smoke test for the feature/label logic
Skipped: XGBoost. sklearn’s GradientBoosting gives the same result with one
fewer dependency. Swap in xgboost.XGBClassifier/XGBRegressor if you need
the extra speed on a much larger dataset.
Support
Submit issues, questions, or bug reports to the GitHub issue tracker: https://github.com/ADM1SH/ecommerce-churn-ltv-dashboard/issues
Roadmap
- Done: Core architecture and baseline implementation.
- Done: Functional verification and test coverage.
- To do: Add automated Cohort Analysis heatmaps
- To do: Implement exportable PDF executive summary reports
Contributing
Contributions are welcome.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/improvement. - Commit your changes:
git commit -m "feat: enhance functionality". - Push to the branch:
git push origin feature/improvement. - Open a Pull Request.
Authors and Acknowledgment
- Adam Anwar (ADM1SH) - Lead architect and developer.
- Engineered by Adam Anwar for e-commerce churn probability and customer LTV forecasting.
License
Licensed under the MIT License. See LICENSE for details.
Project Status
Complete customer lifetime value analytics platform.