Meet Elizabeth Benson, Computer Scientist and Mawazo Scholar


Tackling Nairobi’s Traffic Congestion Through Data Mining And Machine Learning

 By Elizabeth Benson

Traffic congestion is a major problem in urban areas globally. As cities grow, their infrastructure is strained as the rate of population increase outpaces that of infrastructure development. In Nairobi, a growing  middle class means  that car ownership is  within the  reach  of more residents, and this increasing number of private cars must then share the poorly designed and congested roads with a frenzied mix of commuter mini-buses (“matatus”), freight trucks, motorcycles, pedestrians, and even grazing cattle in some cases. Typically, drivers in Nairobi end up stuck in heavy traffic for long hours, and the situation  is often exacerbated further during rainy seasons. It is estimated that Kenya loses Ksh. 2.1 billion a year due to the lost productivity of active citizens caused by time wasted in traffic jams. Traffic congestion also impacts transportation costs, which are very high in Nairobi compared to a commuters’ average income. For example, average bus fare during peak hours locations within 10km and 20km from the city center is Ksh. 50 and Ksh. 100 respectively, compared to the current  minimum employee wage that ranges between Ksh. 270 to Ksh. 400 a day.

The Government of Kenya (GoK) and the Nairobi City County (NCC) are taking many steps to address traffic congestion issues in Nairobi. Notably, significant investments have been made to improve road infrastructure, including expansion of major highways and development of new bypass routes. Adoption of smart city tools such as installation of digital traffic cameras is another approach to tackle congestion. To this end, GoK and NCC have installed traffic cameras along roads leading into the city centre that capture images of vehicles in real time. This data can be utilized in the development of intelligent transport systems for predicting road traffic, which is the focus of my Ph.D. research.

Currently, Nairobi drivers can gauge real-time traffic conditions using a variety of tools. These include crowdsourced traffic information shared by drivers via platforms such as popular radio stations, twitter, and mobile applications such as ma3route. The major limitation with these systems is that they require a user to post the congestion status based on their location at a specific time. The traffic status on these routes changes over time, so another user is required to update the new status at the same location to keep the information current. Users must also be online to receive traffic updates on many of these platforms, while not all drivers have smart phones or can be online all the time. 

The use of navigation applications such as Google Maps is another way of predicting road traffic. Google’s Traffic feature displays traffic conditions by analyzing location data of drivers using the Google Maps application. One of the biggest challenges of using Google Maps to predict future traffic patterns in Kenya is that there is a limited pool of drivers with smart phones which can send location data to Google. As a result of this, alternative approaches that incorporate more reliable data sources must be developed. To solve this problem, researchers at IBM Research-Africa created the Twende-Twende mobile application, which seeks to improve real-time traffic predictions in cities like Nairobi where high uncertainty and poor infrastructure limit the effectiveness of existing solutions. Twende Twende uses a combination of images captured by traffic cameras on the roads and a network flow algorithm to predict the state of traffic. One challenge with this approach was the low resolution of the images available at the time, which limited the accuracy of the vehicle count data. In their recommendations for future work, the researchers behind Twende-Twende identified improved context awareness and event simulation as two areas requiring additional work, and my research findings will help to address these challenges.

To improve predictability, I am developing a new hybrid traffic model that combines a statistical model named STARIMA, which is efficient at predicting short-term traffic conditions, and a Decision Tree model, which will utilize historical traffic patterns to predict probabilities of future traffic jam occurrence. The model will be tested using data generated from traffic cameras along four major roads leading into the city: Ngong Road, Mombasa Road, Waiyaki Way and Thika Super Highway. These four roads connect major population centers to the Central Business District (CBD), with smaller roads from various housing estates in Nairobi joining them as they approach the city, hence the congestion. The data is available through databases published by the Kenya Urban Roads Authority (KURA) and the World Bank, providing hourly, monthly, and annual information on car densities produced from the new higher resolution traffic cameras installed since 2013. Once validated through comparisons with this real-world data set, my hybrid model will then be applicable for predicting road traffic in Nairobi and other smart cities. 

As a computer scientist, I am passionate about transforming Nairobi into a smart city. Transportation is a sector that is well suited to predictive tools such as those developed in my research, and can yield significant benefits by reducing traffic congestion in the city and empowering Nairobi residents to make better travel choices. 

 (Source :

(Source :


Elizabeth Ndunge Benson is an Information technology Lecturer at Dedan Kimathi University and PhD student at Jomo Kenyatta University of Science and Technology. Her research topic is “Data Mining for Smart Cities: Predictive Analytics for Minimization of City Traffic Congestion. A Case Study on Nairobi City”. She is passionate about using information technology to empower women in her community.