Universitat Politècnica de Catalunya. Departament d'Estadística i Investigació Operativa
Sánchez Espigares, Josep Anton
2025-10-22
Accurately forecasting customer lifetime value (CLV) is central to budget allocation and retention strategy in non-contractual e-commerce settings. This thesis presents a comparative study of three approaches on the UCI Online Retail II dataset: (i) tree-based machine learning models (Random Forest and XGBoost) trained on engineered time-window features, (ii) the same models augmented with unsupervised segmentation signals, and (iii) a hybrid deep learning architecture combining Transformer encoders for temporal covariates with an LSTM pathway for purchasing trends and a sequence decoder for multi-month forecasts. To inject segmentation without discarding nuance, I derive distance-to-centroid features from K-Means clusters learned on TSFresh time-series representations, rather than using coarse cluster labels. The evaluation follows a temporally consistent train/validation/test split with group-aware cross-validation by customer and reports MAE, RMSE, and R2. Empirically, XGBoost achieves the strongest out-of-sample performance, the deep model is intermediate, and Random Forest trails. Adding distance-to-centroid features yields a modest gain for XGBoost but slightly degrades Random Forest, indicating that boosted trees can extract weak but useful segmentation signals while bagged trees are more sensitive to noise. Feature importance analysis shows that monetary variables (total and average spend) dominate across models, with frequency and tenure contributing second-order signals; distances to specific clusters add incremental lift and provide interpretable behavioral archetypes. Managerially, the results support segment-aware targeting of high-value lookalikes and reinforce the practicality of gradient boosting on structured tabular features for CLV. Methodologically, this thesis contributes an end-to-end, reproducible pipeline that blends sequence-aware engineering with segmentation-as-features. Limitations include dataset size and a limited hyperparameter search for the deep model; future work should explore uncertainty quantification, per-segment specialist models, and larger-scale tuning to assess the conditions under which deep architectures surpass tree-based ensembles for CLV.
Master thesis
English
Àrees temàtiques de la UPC::Informàtica::Intel·ligència artificial::Aprenentatge automàtic; Deep learning (Machine learning); Customer Lifetime Value (CLV); Time series forecasting; Machine learning; XGBoost; Random forest; Deep dearning; Transformer; LSTM; TSFresh; K-Means clustering; Feature engineering; Segmentation; Gradient boosting; E-commerce; Predictive modeling; Aprenentatge profund (Aprenentatge automàtic)
Universitat Politècnica de Catalunya
Restricted access - confidentiality agreement
Treballs acadèmics [82539]