Predicting customer lifetime value in e-commerce: an empirical evaluation of tree ensembles, neural sequence models, and time-series clustering

Other authors

Universitat Politècnica de Catalunya. Departament d'Estadística i Investigació Operativa

Sánchez Espigares, Josep Anton

Publication date

2025-10-22



Abstract

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.

Document Type

Master thesis

Language

English

Publisher

Universitat Politècnica de Catalunya

Recommended citation

This citation was generated automatically.

Rights

Restricted access - confidentiality agreement

This item appears in the following Collection(s)