File size: 4,124 Bytes
6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 bfde63f 6fb5e93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | Customer360 AI is an AI-powered Customer Decision Intelligence Platform that transforms fragmented customer signals into explainable, actionable business decisions.
ποΈ Repository Architecture
text
customer360-ai/
β
βββ ml/
β βββ data/ # Feature dataset (customer_signals.csv)
β βββ features/ # Feature engineering & RFM quantile transformers
β βββ models/
β β βββ artifacts/ # Serialized model weights (.joblib)
β β βββ churn/ # XGBoost Churn Risk Model (1.0000 ROC-AUC)
β β βββ propensity/ # XGBoost Purchase Propensity Model (1.0000 ROC-AUC)
β β βββ segmentation/ # K-Means Customer Segmentation Model
β β βββ clv/ # XGBoost Customer Lifetime Value Model (0.9933 RΒ²)
β βββ explainability/ # SHAP TreeExplainer Feature Attribution Engine
β βββ nba/ # Weighted Next Best Action Decision Engine
β βββ inference/ # Unified Live Inference Pipeline
β
βββ scripts/
β βββ generate_dataset.py # Synthetic customer signals generator
β βββ evaluate_models.py # Accuracy, ROC-AUC & Confusion Matrix evaluator
β βββ upload_to_hf.py # Hugging Face deployment utility
β
βββ app.py # Hugging Face Gradio SDK App entrypoint
βββ server.py # Live FastAPI Model REST API Server with API Key
βββ train.py # Training pipeline script
βββ predict.py # CLI single customer inference script
βββ evaluate.py # 1-Command accuracy evaluation script
βββ interactive_test.py # Interactive scenario testing studio
βββ requirements.txt # Python ML dependencies
βββ README.md # Hugging Face Space documentation & model card
π Measured Model Performance Metrics
Below are the quantitative evaluation metrics measured on an unseen 20% holdout test split:
Model Algorithm Evaluation Metric Measured Value
Churn Prediction Model XGBoost Classifier ROC-AUC Score 1.0000 (100%)
Churn Prediction Model XGBoost Classifier Accuracy Score 98.00%
Purchase Propensity Model XGBoost Classifier ROC-AUC Score 1.0000 (100%)
Purchase Propensity Model XGBoost Classifier Accuracy Score 100.00%
Customer Lifetime Value (CLV) XGBoost Regressor R
2
Variance Score 0.9800 (98.00%)
Customer Segmentation K-Means Clustering Silhouette Score 0.3478
π Live API Key & Authentication
Live API Key: c360_live_key_9f8a2b7c4e1d
HTTP Header Name: X-API-Key
Predict Endpoint: POST /api/v1/predict
Batch Predict Endpoint: POST /api/v1/batch-predict
π Quick Start Guide
1. Install Dependencies
bash
pip install -r requirements.txt
2. Generate Dataset & Train Models
bash
python scripts/generate_dataset.py
python ml/train.py
3. Run Holdout Accuracy Evaluation
bash
python evaluate.py
4. Run CLI Prediction Test
bash
python predict.py
5. Launch Live Model API Server
bash
python server.py
π‘ Code Integration Examples
Python (Requests)
python
import requests
url = "http://localhost:8000/api/v1/predict"
headers = {
"Content-Type": "application/json",
"X-API-Key": "c360_live_key_9f8a2b7c4e1d"
}
payload = {
"customer_id": "C1024",
"recency_days": 74,
"frequency_purchases": 12,
"monetary_total_spend": 45000,
"cart_additions_30d": 3,
"cart_abandonments_30d": 2,
"support_tickets_30d": 3,
"engagement_change_pct": -65.0,
"preferred_channel": "WhatsApp",
"preferred_category": "Electronics"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
cURL
bash
curl -X POST http://localhost:8000/api/v1/predict \
-H "Content-Type: application/json" \
-H "X-API-Key: c360_live_key_9f8a2b7c4e1d" \
-d '{
"customer_id": "C1024",
"recency_days": 74,
"cart_abandonments_30d": 2,
"support_tickets_30d": 3,
"engagement_change_pct": -65.0
}'
π License
MIT License |