Dataset-first Python AI/ML project

Explainable AI-Based Retail Customer Behavior Prediction and Personalized Recommendation System

A guarded project workspace for an executable Python pipeline: inspect the real retail schema first, then run only the analytics, prediction, recommendation, and explanation modules your dataset can truthfully support.

Data rows

Available after an original CSV is inspected.

Columns

No schema has been assumed.

Missing cells

Calculated from the actual uploaded file.

Duplicate rows

Exact duplicate detection runs at inspection time.

Inspect your retail dataset

Upload the original CSV to inspect its real schema in this workspace. The accompanying Python pipeline accepts both CSV and Excel files when you run it locally.

Drop one CSV file here or choose it above

No customer or purchase metrics are assumed before inspection.

No dataset inspected yet

Start by selecting the original retail CSV. This project will map only columns it can actually find and will clearly flag any unavailable AI/ML module.

Executable pipeline readiness

Every module is dataset-gated

The local Python implementation saves genuine figures, metrics, tables, SHAP artifacts, and a final report only when its prerequisite columns and data sufficiency checks pass.

Awaiting dataset

Customer behavior features

Builds recency, frequency, monetary value, average order value, quantity, product diversity, and purchase cadence at customer level.

Requires customer, date, and transaction value signals.

Awaiting dataset

RFM segmentation

Selects an appropriate K-Means cluster count using elbow and silhouette diagnostics, then derives human-readable segment labels from cluster behavior.

Requires the customer behavior feature dataset.

Awaiting dataset

Time-based churn prediction

Creates a future-inactivity target from the transaction timeline and compares Logistic Regression, Random Forest, and XGBoost without data leakage.

Requires customer transactions over enough time.

Awaiting dataset

Product recommendation

Uses Apriori association rules for market baskets and, where interactions allow, an item-based collaborative filtering signal for recommendations.

Requires a product field plus a transaction ID or customer-date basket key.

Awaiting dataset

Explainable AI

Applies SHAP to the selected churn model and saves global importance, a SHAP summary, and a real individual-customer explanation.

Depends on a viable time-based churn model; no explanations are fabricated.

Local execution

Run the pure Python project

Use the included retail_xai_pipeline.py script with your original dataset. It supports CSV and Excel input, writes outputs to a folder you choose, and records skipped modules and limitations in the generated report.

Command

python retail_xai_pipeline.py --input your_retail_dataset.csv --output outputs

Model safety: churn labels use a temporal split, and model comparison is skipped rather than faked when the data cannot form both classes.

Business output: the final customer intelligence table joins supported segments, churn risk, and recommendations without filling unsupported columns with fabricated values.

Built with GenMB
Built with GenMB