Site navigation

Predicting the Unpredictable: The Power of ML Forecasting

Matyáš Kapusta

,

Cybersecurity skills
In this contributed piece for DIGIT, Matyáš Kapusta, Data Science Team Leader at Revolt BI, looks at the power of ML Forecasting in logistics during Covid and beyond.

In the beginning, there was one simple idea, one simple question.

“What if we could predict the future?”

The person asking this question was Aliaksei Siparau, Head of Logistics at Sportisimo, the leading Central European retailer of sports equipment and apparel.

The year was 2018 and the company was selling millions of items each year, with two hundred branches spread across five countries in CEE. In addition to that, e-shop sales had been increasing every year and it became increasingly difficult to manage the entire logistics process. They were not able to react quickly to the dynamically changing demand, which increased the cost of logistics and also meant lost profits.

The customer is always right

When the customers’ demand increased, the first people to know were the branch salespeople and e-shops. If they didn’t have sufficient goods at their disposal, they sent requests for replenishment. Warehouses would then receive these requests and, within a few days, products would be prepared and trucks sent to replenish the shops.

The problem was that customers wouldn’t always want to wait a few days, and under these circumstances, huge missed opportunity costs appeared.

A typical customer would wake up one morning, look outside and see that the weather was good, and impulsively decide to go jogging. If they needed shoes, t-shirts, bottles – or anything else – they wouldn’t wait several days for it to arrive, they would go to the nearest shop, buy whatever they needed and if the shop doesn’t have it, tough luck – the competition would.

Challenges

Huge effort went into optimising the replenishment process. As the reaction times were being pushed from days to hours, the costs kept increasing – costs to ensure enough trucks would be available, enough workers to quickly process the goods, enough resources to prevent errors while increasing speed.

Everything led to larger and larger sums being spent by the logistics department. Eventually Sportisimo reached its peak in reaction time – it was simply impossible to react faster.

Plus the increase in logistics capacities wasn’t always necessary. In the sports accessories market what happens is a large number of peak moments occur during different times per year. Outside of these peaks, the replenishment network would be underutilised. Meaning: too expensive. But if the company’s logistics weren’t ready for the peaks, they would miss out on millions in revenue.

“What if we could predict the future? If we had a crystal ball that could tell us what the clients of Sportisimo would buy in the upcoming weeks, we would have plenty of time to prepare the goods beforehand. There would be no more need to react in a few hours, as the products could be shipped to shops and warehouses several days in advance.”

Sportisimo didn’t have a crystal ball.

What they did have was intuition and the experience of its warehouse managers, sales teams and other departments. They weren’t stupid, and knew that when the weather was forecast as such and such, the right goods should be prepared accordingly.

However, this approach had severe limitations. Often these specialists would focus only on their own small niche in goods – no one could hold the needed knowledge concerning hundreds of thousands SKUs in their heads. Even less so their seasonality, customer reaction to weather conditions, etc.

Also, the company was growing –  as Sportisimo explored new markets and hired new personnel, the number of junior employees increased, making it extremely difficult to possess and share the know-how. Somehow, the process still worked, but the deviations from the optimum, the gap between a timely accurate response vs. just making do, kept growing.

And then came Covid

The problem increased a hundredfold by 2020 when Covid arrived.

On one hand, the company flourished. Options to spend free time were severely limited, fitness centers and sports venues were closed, and customers wanted to get fit – whether to boost their immunity, use the free time to get in shape,  or just do whatever they could to relieve the boredom of home offices. The demand for domestic sports equipment was soaring.

On the other hand, the earlier problems crystallized. Basically overnight, the company had to switch from mostly bricks-&-mortar branch-driven sales to 100% e-commerce. Branches were closed and empty of people (not stock), while warehouses were working at 200-300% of their usual capacities.

Looking at it from a certain time perspective, it’s almost amusing. When people couldn’t go to the gyms, suddenly there was a huge demand for dumbbells, weights to lift, etc. By definition, these things are heavy! There were received complaints from the warehouse staff that the shifts were too exhausting – literally!

The need for a quicker response to impulse buys didn’t disappear by moving to e-comm. If anything, it worsened. In a smaller town, there could be maybe three different sports equipment vendors within walking distance.

Online, there were hundreds. If you couldn’t offer up reasonable delivery times and keep that promise, you would quickly lose customers to the competitors. And online ratings made sure any failures quickly went public for new online shoppers to see.

Suddenly Sportisimo was in new waters – the pandemic and lockdown scenario was unlike anything experienced before, baffling even seasoned senior managers, let alone the younger personnel.

Suddenly demand was shifting irrespective of trends and patterns of previous years. With spiking demand, less time to act, and less reliable knowledge from the past, it became obvious that the logistics department needed help.

It was at this time we were asked by Sportisimo to “try to solve the problem using Machine Learning”. Alex Siparau is a tech-savvy manager, with an appreciation of BI and its capabilities, and we already cooperated on similar projects in the past. “We” being Revolt BI, a data consultancy agency that specialises in using data and machine learning to help companies solve their business problems.

Crystal ball engineering

The task was quite clear – to develop a tool that could show anyone, from warehouse operators to logistics managers, which sales could be expected during the upcoming days and weeks. As usual, the devil was in the details. One “detail” was the scope – with 200 000 SKUs being sold annually, millions of predictions had to be made and recalculated every day.

Covid effects – sicknesses, distancing, work-from-home, canceling of travel and group activities – compounded by rapidly changing regulations, both tightening and relaxing, needed to be added in. Last but not least, product data availability was limited – some products had only been launched that very year, so there was no historic data to learn from, and these were usually the most important items.

This made the most obvious ML approach, “just toss it into a Time Series model”, simply not applicable. Another popular one, “fill a neural network or another Deep Learning model with data and just gather the results” was also useless.

What data would you use for learning starting in March 2020? What would you use for validation? And for testing? When you finally realised that the upcoming weeks and months would bring nothing similar to what had happened at any given moment in the past?

Sportisimo’s previous forecasting tool of choice was a simple aggregation of multiple previous years. For any given month, they would calculate the average sales of each category over several years and use that to estimate the upcoming sales. Even without Covid, this approach had several issues:

  • Sales aren’t always normally distributed. If you sell 100 skis when it snows and 10 when it doesn’t, you don’t want the model to tell you that you can expect 55 skis in either case.
  • The approach ignores trend effects, problematic for growing markets – if your sales double each year, the average of past years is nearly useless.

We developed a solution that can predict sales of individual stock units with up to 90% accuracy by using available sales data, weather data, and customer sales behavior, using a data model and advanced analytics.

Getting answers

What comes out of our prediction model? The most obvious output, the forecast itself, actually has a very simple structure – some eight million rows of this:

PredictionDate ProductCode BranchCode Date SalesQtyPred
2022-03-01 148643 721 2022-03-15 27.89
2022-03-01 235887 105 2022-03-12 4.53

So the first row says that on March 15th, we expect to sell about 28 items of ProductCode 148683 (running socks) out of Branch 721 (CZ e-shop). And we know this 14 days in advance, because the prediction was made on March 1st.

Here you can see why good data summarisation is crucial – no human can go through eight million rows of output and come up with any useful insights. However, with good categorisation of products and branches, a computer can easily compile this output to answer questions such as:

  • Which products are going to be top-sellers in the upcoming weeks?
  • How many running shoes do we expect to sell in region CZ NorthWest?
  • Which product categories are on the rise?
  • Which are declining?

If you already have reasonable analytics about previous sales, stock availability, etc. (which you should, because otherwise creating an accurate forecast model would be rather difficult), you can also start answering even more interesting questions:

  • Are our branches and warehouses ready for the upcoming demand?
  • Which product categories tend to sell better in different regions?
  • How is this year’s sales curve going to differ from last year’s?
  • Do we have goods on display that are unlikely to sell in upcoming weeks?
  • How do we align marketing activities with forecasted demand?
  • How to extend these predictions to help our procurement/suppliers/manufacturers?
  • Are we ready for availability shortage of items in the supply chain?

However, the model can calculate quite a bit more than just the output itself. Since it runs continuously, it can check its own results against real behavior, evaluate its own performance, and output expected accuracy, to provide a degree of confidence and assist self-learning. Overall performance and accuracy can be measured, but even more interesting is to look at particular products and see:

  • Categories that can be predicted very accurately
  • Categories that show strong seasonal behavior or are affected by other fluctuations
  • Categories that for some reason can’t be reliably predicted
  • Categories with overall growing/shrinking tendency

Same insights can, of course, be applied to branches, markets, products, etc.

Assessing the business impact

The first direct business effect was on the warehouse itself. Like many other retail warehouses, this one operates in shifts. Unlike pre-Covid times, peak hours reflect when clients typically send their online requests. This is when the warehouse operators and pickers are extremely busy and operate at 100% capacity. However, outside of peak hours they have some time to prepare. With a prediction model, they can use this time to preallocate the top-selling or frequent bulkier products to more easily accessible locations (e.g. lower shelves, nearer the loading dock etc).

In hard numbers, the share of the most costly warehouse operations, so called “high-picks”,  decreased by 33%. The overall warehouse workload was reduced by 10%. Just this aspect alone of the larger ML model implementation showed up as appreciable ROI already in Year One.


Recommended


Slightly less apparent, but even more significant, is the effect of prediction on revenues. Simply speaking, if the goods desired by customers are available at the branches, clients are more likely to come and buy these products. This has a very positive impact on sales.

Four keys to success

The model developed has proven to be usefully practical, able to quickly adapt to changes in the environment. Quick reaction and adaptability unfortunately were needed even more due to the unexpected and devastating events related to the pandemic starting in the first months of 2020. We do hope that the future will be brighter. Even at our most optimistic though, the future is guaranteed to bring more surprising twists, seemingly accelerated, such that even the higher pace that traditional approaches will have trouble keeping up. Successful implementation of modern technologies needs to respect that:

  • Situations can change rapidly
    -> models need to adapt quickly in order to be useful
  • Reactions must be quick
    -> fast, accurate data is not a luxury – now it’s a necessity
  • Technology advances
    -> best solutions leverage available evolving options and best practices
  • Quantity of available information grows
    -> scaling of data integration & utilization is just as important as its collection

Whenever you’re dealing with technologies that are meant to help the business, always ask yourself if they meet these points.


Get the latest news from DIGIT direct to your inbox

Our newsletter covers the latest technology and IT news from Scotland and beyond, as well as in-depth features and exclusive interviews with leading figures and rising stars.

To subscribe, click here.

Matyáš Kapusta

Data Science Team Leader at Revolt BI

Latest News

AI

Nvidia Launches Open Secure AI Alliance for AI Safety and Security

AI Business Recruitment

Nearly a Quarter of Orgs Reducing Entry-level Hiring Due to AI Automation

Business

Scottish Businesses Turn to Self-funding as Growth Confidence Dips in H2

Data Finance

Payment Leaders are Struggling to Get Real-time Data