Skip to content Skip to footer

Data-Driven Retail: Predicting Demand With Advanced Analytics

The use of advanced analytics in retail could transform the retail industry in Sudan, resulting in better inventory management, higher customer satisfaction, and higher liquidity ratios.

Imagine being able to anticipate exactly what your customers want, when they want it, and ensuring that your shelves are always stocked with the products they need. This article presents a machine learning solution that can predict Next week’s demand of a retail product with an average error of 2.3%.


Accurately predicting retail demand is a challenging task for retailers. inaccurate estimations of future demand can negatively affect; Inventory management, customer satisfaction, and liquidity ratios. 

In this article We present a machine learning model that can predict the future consumer demand for Bananas given historic data. We use real transactional data from one large supermarket in Khartoum.

Actual demand vs forecast demand on last 6 months of data


In order to develop our machine learning model, we first identified the range of
our data (01/04/2020 – 20/09/2022) and extracted some domain specific features such as the day of the week and whether the date is during Ramadan.

We removed missing values and dealt with outliers before splitting the
data into a training and testing datasets. This is done to ensure that the model can deal with previously unseen data and that it can detect general patterns that persist over time.

We used XGBoost, a popular machine learning algorithm (known for its flexibility and ability to handle complex data). We then trained our model on the training data set, withholding the most recent 6 months data to testing the generalisability of our model. Moreover, Cross validation was used to avoid overfitting.


Imagine a scenario where a supermarket wants to restock bananas for the next week. We applied our model to predict next week’s demand given the historic supermarket data, and the results were astounding.The graph below shows the actual Vs. the predicted demand for bananas on each day of the week (20th Sep 2022 to 27th Sep 2022).

Our model had an average error rate of 1.63 Kg per day. In other words, our model scored an average error of 2.3% for the whole week.

Actual demand vs forecast demand on new data

Our case study demonstrates that machine learning can provide accurate demand forecasts. With the accurate prediction of demand, supermarkets can make better-informed decisions that can help optimize their supply chain, improve their liquidity ratios, and improve customer satisfaction.

*Disclaimer: The data presented here is shared under a Data Sharing Agreement signed by DataQ and Data Owner. The owner has authorised the use of this data for research purposes.

Our machine learning model is just one example of the cutting-edge research that our team is capable of. We have a wealth of expertise in data analysis, predictive modeling, and other advanced research techniques that can be applied across a wide range of industries and use cases.

If you’re interested in learning more about our research capabilities or how we can help you achieve your business goals, please don’t hesitate to get in touch with us today. We would be happy to discuss your needs and provide you with a customized solution that meets your unique requirements.

Contact us to see how we can help!

    1 Comment

    • Identify unknown caller
      Posted November 2, 2023 at 6:15 pm

      This post has been incredibly helpful for me, much appreciated.

    Leave a comment


    Flat 3, Floor 1, Burj Al Isra, shaheed road, Bahri, Khartoum, Sudan

    Contact Information



    DataQ © 2024. All Rights Reserved.