Forecasting retail consumer purchase trends in Kenya using machine learning algorithms
Loading...
Date
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
Strathmore University
Abstract
Understanding consumer purchasing behavior is essential for retailers in Kenya, particularly in the dynamic context shaped by evolving socio-economic factors and the impacts of the COVID-19 pandemic. This study aimed to analyze consumer purchasing patterns by leveraging advanced machine learning algorithms, including Random Forest (RF), Extreme Gradient Boosting (XGBoost), k-Nearest Neighbors (KNN), and Artificial Neural Networks (ANN), using a multi-output approach to predict multiple consumer behavior variables simultaneously. The analysis utilized survey data collected from 2020 to 2024, focusing on demographic and economic variables such as gender, age group, occupation, and income level, alongside purchasing trends across diverse product categories, including hygiene products, groceries, and electronics. The improved Random Forest model, optimized through hyperparameter tuning, emerged as the best-performing model with an accuracy of 78% for predicting age group and 73% for income level. Confusion matrix analysis revealed the model’s proficiency in identifying dominant classes while highlighting challenges in distinguishing minority classes, particularly within occupation and income categories. Additionally, SHAP (SHapley Additive exPlanations) analysis demonstrated a balanced feature contribution, reducing the risk of overfitting and enhancing model interpretability. To facilitate practical application, the model was deployed using Streamlit, enabling real-time predictions and interactive data exploration for stakeholders. The study’s findings provide significant insights into the key economic and demographic factors influencing purchasing behavior in Kenya. By integrating data-driven analytics into retail decision-making, businesses can optimize inventory management, targeted marketing, and strategic planning. This research contributes to bridging the gap between academic analysis and practical retail applications, offering a replicable framework for similar contexts in emerging markets.
Keywords: Consumer Purchasing Behavior, Machine Learning, Predictive Modeling, Multi-Output, Decision-Making.
Description
Full - text thesis
Keywords
Citation
Claudine, L. W. N. (2025). Forecasting retail consumer purchase trends in Kenya using machine learning algorithms [Strathmore University]. https://hdl.handle.net/11071/16421