Machine learning-based prediction of household sanitation facility access in Sub-Saharan Africa: insights from DHS data (2012–2024)
Gelila Yitageasu, Eyob Akalewold Alemu, Eshetu Abera Worede, Mitkie Tigabie, Lidetu Demoze
Abstract
BACKGROUND: Access to adequate sanitation facilities remains a major global public health challenge, with an estimated 3.6 billion people lacking safely managed sanitation. Most of these populations reside in low- and middle-income countries, particularly in sub-Saharan Africa (SSA). Sanitation utilization is influenced by socioeconomic, demographic, housing, and environmental factors, contributing to the burden of fecal–orally transmitted diseases. This study aimed to predict household sanitation facility access in SSA using machine learning techniques. METHODS: Data were obtained from Demographic and Health Surveys (DHS) conducted between 2012 and 2024 across 34 SSA countries, comprising 500,845 households. A stratified two-stage cluster sampling design ensured national representativeness. Five supervised machine learning models, Random Forest (RF), Decision Tree (DT), Extreme Gradient Boosting (XGBoost), Logistic Regression (LR), and Artificial Neural Network (ANN) were developed. The dataset was split into training (80%) and testing (20%) subsets. To address class imbalance, the Synthetic Minority Oversampling Technique (SMOTE) was applied, followed by 10-fold cross-validation. Model performance was evaluated using accuracy, precision, recall, F1-score, and AUC-ROC. Feature importance was interpreted using Shapley Additive Explanations (SHAP). RESULTS: The prevalence of unimproved sanitation facility access was 49.85%, with substantial disparities observed within and across countries. The Random Forest model demonstrated the best predictive performance (accuracy = 80.61%, F1-score = 0.8377), outperforming other algorithms. SHAP analysis identified shared toilet (feature importance = 0.233), education level (0.204), and wealth index (0.094) as the most influential predictors, followed by residence, electricity access, age of the household head, drinking water source, household water treatment, and cooking fuel type. Media access, sex of the household head, handwashing facility, water access, soap presence, location of water source, marital status, and household size also contributed notably. The number of under-five children had minimal predictive influence. CONCLUSION: Machine learning models, particularly Random Forest, effectively predicted sanitation facility access in sub-Saharan Africa, highlighting key socioeconomic and infrastructural determinants. Targeted interventions such as economic empowerment, health education, infrastructure investment, and media engagement are essential to reduce reliance on unimproved sanitation and accelerate progress toward the Sustainable Development Goals.