harbor run -t LiteCoder/retail-clustering-profit-pipelineharbor download LiteCoder/retail-clustering-profit-pipelineBuild a three-tier unsupervised segmentation pipeline for retail transactions, calibrate a profit-response model, and visualize profit drivers.
Language: Python 3.x
Required Libraries: pandas, numpy, scikit-learn, xgboost (or lightgbm), matplotlib, seaborn, shap, kmodes, openpyxl, requests
Input:
/app/data/raw/Online_Retail.xlsxOutput Files:
/app/data/processed/cleaned_data.csv - Cleaned transaction data with Cancelled flag/app/data/processed/rfm_features.csv - RFM features with product-level aggregates/app/data/processed/clustered_data.csv - Data with all cluster labels (customer_cluster, product_cluster, basket_cluster)/app/models/profit_model.joblib - Trained gradient boosting model/app/visualizations/profit_analysis.png - Bar chart + SHAP summary visualization/app/retail_segmentation.py - Complete executable pipeline script/app/README.md - Documentation (max 250 words)/app/checksums.txt - MD5 checksums of all output artifacts1. Data Cleaning:
/app/data/processed/cleaned_data.csv2. Feature Engineering:
/app/data/processed/rfm_features.csv3. Three-Layer Clustering:
/app/data/processed/clustered_data.csv4. Profit-Response Model:
/app/models/profit_model.joblib5. Visualization:
/app/visualizations/profit_analysis.png6. Executable Script:
/app/retail_segmentation.py that runs entire pipeline with single command7. Documentation:
/app/README.md with purpose, inputs, outputs, and execution command8. Reproducibility:
/app/checksums.txt9. Cleanup:
cleaned_data.csv columns (minimum):
rfm_features.csv columns (minimum):
clustered_data.csv columns (minimum):
checksums.txt format:
<md5_hash> data/processed/cleaned_data.csv
<md5_hash> data/processed/rfm_features.csv
<md5_hash> data/processed/clustered_data.csv
<md5_hash> models/profit_model.joblib
<md5_hash> visualizations/profit_analysis.png
The pipeline must be executable with a single command from /app/:
python retail_segmentation.py