Travel Time Prediction — Ward-Level Regression

This competition is hosted on Zindi, a machine learning platform for data science challenges.

TL;DR: In multi-source geospatial regression, the feature fusion strategy matters more than the model. Each data source requires a spatial join matched to its geometry, and within-unit variation (not just averages) often carries the strongest signal. When the feature space outgrows the sample size, use interpretable dimensionality reduction that domain experts can validate rather than opaque projections.

The Problem

The variable we needed to predict — the rate of female-headed households below a wage threshold per ward in South Africa — is a socioeconomic indicator that depends on factors ranging from geographic accessibility to infrastructure proximity. This isn't a standard tabular problem where features and targets come from the same source. The target is a census-derived statistic measured at the ward level, and the features come from entirely separate data systems: road networks, traffic sensors, transit routes, and weather stations.

The fundamental modeling challenge is that the unit of prediction (a geographic ward) doesn't directly correspond to any single data source. Traffic sensor readings describe road segments. Transit data describes station locations. Weather data describes point measurements. Somehow, all of these need to be fused into a ward-level representation that captures the accessibility and infrastructure context that drives socioeconomic outcomes.

Beyond the data fusion challenge, the feature space after joining all sources was enormous relative to the number of wards. With hundreds of potential features and relatively few observations, dimensionality reduction wasn't optional — it was essential for any model to generalize. The question was how to reduce dimensions without losing the signal buried in correlated feature groups.

My Approach

I treated this as a multi-source spatial feature fusion problem. Each data source — road networks, VDS traffic sensors, transit routes, weather stations — required its own spatial join strategy to link it to ward-level observations. Road network attributes were aggregated by road segments within each ward. Traffic sensor data (speed, jam factor, vehicle counts) was summarized at the ward level using proximity-weighted averages. Transit route information was captured through station distance thresholds that classified wards as urban or banlieu.

The key spatial engineering insight was that raw proximity isn't enough — you need to capture the variation in accessibility within a ward. I computed both the mean and standard deviation of GPS trace distances within each ward, encoding geographic spread as a feature. A compact urban ward with uniform access to transit looks fundamentally different from a sprawling peri-urban ward where some residents are close to infrastructure and others are isolated, even if the average distance is similar.

For dimensionality reduction, I used ClustOfVar — hierarchical variable clustering with stability analysis — rather than standard PCA. The advantage of variable clustering is that it groups correlated features while preserving interpretable structure. Instead of abstract principal components, you get clusters of related variables where you can select a representative or take the cluster centroid. This produces a reduced feature set that a domain expert can still understand and validate.

The final model was a three-model ensemble of XGBoost, CatBoost, and LightGBM, each trained independently on the reduced feature set. A BEST_CONFIG.R file consolidated the optimal hyperparameters found across all experiments, making the pipeline fully reproducible. The ensemble averaging smoothed predictions across model families without adding overfitting risk from a meta-learner on limited data.

Key Decisions

Multi-Source Spatial Feature Fusion

Each external data source required a custom spatial join strategy matched to its geometry: area aggregation for road networks, proximity-weighted averaging for point sensors, distance-threshold classification for transit stations. Generic joins produce noise; source-aware fusion produces signal.

Within-Ward Geographic Variation as Feature

Computing both mean and standard deviation of distances within each ward captures accessibility heterogeneity that averages alone miss. Two wards with the same mean distance to transit can have vastly different socioeconomic outcomes depending on whether access is uniform or concentrated in one corner.

ClustOfVar for Interpretable Dimensionality Reduction

Hierarchical variable clustering preserves interpretable feature groups unlike PCA's opaque components. With limited observations and a domain where feature meaning matters for validation, reducing dimensions while maintaining interpretability prevents both overfitting and silent modeling errors.

Simple Ensemble Over Meta-Learning

With limited ward-level observations, a stacking meta-learner risks overfitting to validation noise. Simple averaging of three gradient boosting variants provides ensemble diversity benefits without the overfitting risk that comes from learning combination weights on small data.

Key Takeaway

This project reinforced that when your target is a geographic aggregate, the hardest work is building a feature representation that captures the spatial context driving the outcome. Model selection is secondary to feature fusion quality. Getting the spatial joins right — matching each data source's geometry to the prediction unit in a way that preserves meaningful signal — is where the real predictive power comes from in geospatial regression problems.

Design insight: In multi-source geospatial regression, the feature fusion strategy matters more than the model. Each data source requires a spatial join matched to its geometry, and within-unit variation (not just averages) often carries the strongest signal. When the feature space outgrows the sample size, use interpretable dimensionality reduction that domain experts can validate rather than opaque projections.

FAQ

What is the key takeaway from "Female Households Travel Time"?

In multi-source geospatial regression, the feature fusion strategy matters more than the model. Each data source requires a spatial join matched to its geometry, and within-unit variation (not just averages) often carries the strongest signal. When the feature space outgrows the sample size, use interpretable dimensionality reduction that domain experts can validate rather than opaque projections.

Who wrote this and what is it about?

This was written by Mahmoud Trigui, Senior Data Scientist. Predicting travel time for female-headed households at ward level in South Africa using socioeconomic features. Ranked Top 38% (258/498 competitors) on Zindi, February 2020.

Comments

Machine Learning Feature Engineering MLForecast Time Series Decomposition Forecasting LightGBM XGBoost Catboost Clustering Segmentation NLP LLMs Web App R Markdown SQL Oracle DB SAS-Guide SAS E-Miner Dataiku BigQuery GCP Python R CRISP-DM Hypothesis Testing ANOVA Data Analytics Dimensionality Reduction Recommendation System Network Analysis Geospace Analysis Spatial Data Embedding Sampling Techniques Decision Rules Data Storytelling CVM Churn Fraud Detection Sentiment Analysis Topic Modeling IBM Watson PowerBI Looker Studio VBA Statistical Learning Ensemble Modeling Stacking Cross-Validation Profiling ABT Construction Plumber Tidyverse Shiny Prophet Deep Learning Scikit-Learn JSON SAS Programming Git VS Code CSS Styling Automated Reporting Outlier Detection Temporal Clustering Startup Survival Pre-Valuation Modeling K-Means Decision Trees Data Science Predictive Modeling SVM LDA Text Classification Weight Prediction Pattern Recognition Real-Time Detection Community Detection Pipeline Automation Data Quality Checks Data Reliability Specification Mapping Business Strategy Marketing Campaigns Try & Buy Frameworks KPI Dashboards Network Quality Sales Analytics Mentoring Statistics Lecturer Remote Work Hybrid Work Consulting Contract Full-Time Freelance Sofrecom Orange Group Tunisia Telecom Kiota Intelligence VC Analytics Series A Prediction Production ML Applied AI Prompt Engineering Business Forecasting Decision Systems Graph Analytics Household Detection Multi-SIM Detection FTTH Forecasting Audit Extraction Infrastructure Classification Pydantic GPT-4 OpenAI API Base64 Classification Zindi Codementor LAAS-CNRS ESSAI MIT xPRO Tunisia ML Competition Cell Tower Analysis Uber Logistics Uber Cape Town Necessary Condition Analysis Behavioral Signals Spike Smoothing Observation Unit Design Dendrogram Ward Clustering VIF Target Encoding Machine Learning Feature Engineering MLForecast Time Series Decomposition Forecasting LightGBM XGBoost Catboost Clustering Segmentation NLP LLMs Web App R Markdown SQL Oracle DB SAS-Guide SAS E-Miner Dataiku BigQuery GCP Python R CRISP-DM Hypothesis Testing ANOVA Data Analytics Dimensionality Reduction Recommendation System Network Analysis Geospace Analysis Spatial Data Embedding Sampling Techniques Decision Rules Data Storytelling CVM Churn Fraud Detection Sentiment Analysis Topic Modeling IBM Watson PowerBI Looker Studio VBA Statistical Learning Ensemble Modeling Stacking Cross-Validation Profiling ABT Construction Plumber Tidyverse Shiny Prophet Deep Learning Scikit-Learn JSON SAS Programming Git VS Code CSS Styling Automated Reporting Outlier Detection Temporal Clustering Startup Survival Pre-Valuation Modeling K-Means Decision Trees Data Science Predictive Modeling SVM LDA Text Classification Weight Prediction Pattern Recognition Real-Time Detection Community Detection Pipeline Automation Data Quality Checks Data Reliability Specification Mapping Business Strategy Marketing Campaigns Try & Buy Frameworks KPI Dashboards Network Quality Sales Analytics Mentoring Statistics Lecturer Remote Work Hybrid Work Consulting Contract Full-Time Freelance Sofrecom Orange Group Tunisia Telecom Kiota Intelligence VC Analytics Series A Prediction Production ML Applied AI Prompt Engineering Business Forecasting Decision Systems Graph Analytics Household Detection Multi-SIM Detection FTTH Forecasting Audit Extraction Infrastructure Classification Pydantic GPT-4 OpenAI API Base64 Classification Zindi Codementor LAAS-CNRS ESSAI MIT xPRO Tunisia ML Competition Cell Tower Analysis Uber Logistics Uber Cape Town Necessary Condition Analysis Behavioral Signals Spike Smoothing Observation Unit Design Dendrogram Ward Clustering VIF Target Encoding