1. Work
  2. E-Commerce Customer Churn & LTV Dashboard
  3. Docs

E-Commerce Customer Churn & LTV Dashboard

Streamlit dashboard that predicts customer churn and lifetime value from transaction logs.

2 min read

Source on GitHub

Predicts customer churn and Lifetime Value (LTV) from transaction logs and presents the results in an interactive Streamlit dashboard.

How it works

  • generate_data.py simulates a 2-year transaction log for 2,000 customers (swap in a real orders export with the same customer_id, order_date, amount columns and everything downstream works unchanged).
  • features.py builds 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) and future_ltv (actual future spend).
  • train.py fits a GradientBoostingClassifier (churn) and a GradientBoostingRegressor (LTV) on the RFM features.
  • app.py is 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.

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/improvement.
  3. Commit your changes: git commit -m "feat: enhance functionality".
  4. Push to the branch: git push origin feature/improvement.
  5. 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.

Back to top