Interactive Streamlit dashboard for customer behavior analytics using the UCI Online Retail Dataset.
The app includes:
- sales and product performance views
- RFM customer segmentation
- churn propensity modelling
- probabilistic CLV prediction
- revenue time-series forecasting
- Overview: KPI cards, monthly trends and top countries/products by revenue
- RFM Segmentation: K-Means clustering with elbow/silhouette previews and segment labels
- Churn Prediction: random forest classification with threshold tuning, confusion matrix and precision-recall / ROC curves
- CLV Prediction: BG/NBD + Gamma-Gamma modelling via
pymc-marketing - Revenue Forecasting: SARIMA and Theta-method models (
statsmodels) with holdout backtest metrics and 90% confidence intervals
- Enhance segment labelling (currently a static list chosen in order)
Recommended (uses the lock file for reproducible installs):
uv syncOr with a standard virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtuv run streamlit run app.py
# or, if using a venv:
streamlit run app.py.
├── app.py
├── app_pages/
│ ├── 1_Overview.py
│ ├── 2_RFM_Segmentation.py
│ ├── 3_Churn_Prediction.py
│ ├── 4_CLV_Prediction.py
│ └── 5_Revenue_Forecasting.py
├── utils.py
├── requirements.txt
├── static/
├── .streamlit/
│ ├── config.toml
│ └── pages.toml
└── data/
└── online_retail_II.csv
streamlitfor the app UIpandas,numpyfor data wranglingplotlyfor interactive visualisationsscikit-learn,scipyfor RFM clustering and transformationsstatsmodelsfor SARIMA and Theta-method forecastingpymc-marketing,pytensor,nutpiefor CLV modelling
- The app currently reads
data/online_retail_II.csvdirectly (inutils.py). - If dependency installation fails, ensure
requirements.txtincludes all packages imported by the code (notablynumpyandscipy).