At the start of 2023, two Kale Group companies, Kalekim and Kale Seramik, wanted a more accurate demand forecast as an input to production planning. The roadmap drawn up for both was the same: first an MVP, then a forecasting process that refreshes itself every month, and finally an application that planners run from a screen. The team and the methods were the same too.
At Kalekim the work became an application called Kalekimforecast within three years, and today it feeds supply, production and logistics planning. At Kale Seramik the results fell short of the target in the first phase and the second phase did not go ahead. This article covers what makes demand forecasting hard in sectors like ceramics and building chemicals, and what separated the two projects.
What makes forecasting hard in this sector
Demand forecasting for products such as ceramic tiles, sanitaryware, tile adhesives, grout and paint is hard for several reasons:
- A deep product hierarchy. Materials roll up into forecasting units (DFUs, demand forecasting units), and DFUs roll up into material groups, subgroups and main groups. The level at which to forecast is a decision that has to be made up front.
- Many product attributes. Each material has dozens of attributes such as colour, series and packaging, and these attributes have very many distinct values. At Kalekim a single main group had hundreds of different colour names.
- Multi-channel sales. Domestically: corporate dealers, retail dealers, projects, DIY and OEM; abroad, dozens of countries. Each channel behaves differently.
- A long tail. A few products carry most of the sales; the rest sell sparsely and irregularly.
- Structural breaks. The economic volatility of 2022 and the February 2023 earthquake in Turkey created movements in construction and building materials demand that historical data could not teach.
Carrying product attributes to the forecasting level
The forecast is made at DFU level, while product attributes sit at material level. A DFU can contain dozens of materials in different colours and packaging. The real modelling question is how to carry these attributes up to the DFU. We tried three methods:
- Most frequent value (M1). For each attribute, the most common value among the materials under the DFU is taken.
- Distribution (M2). The values of each attribute are counted within the DFU; the DFU is represented by a distribution of attributes.
- Target encoding (ME). Material attributes are converted to numbers by relating them to sales, then aggregated to the DFU.
At Kalekim, M1 proved ineffective while M2 and ME delivered results. At Kale Seramik the best method was M2; M1 and ME added nothing. In both projects the models were built with AutoML, with automatic selection between XGBoost and LightGBM.
Classic time series features such as lags and moving averages were tested too. At Kalekim they lost their meaning as the level of detail increased, so they were not included in the model.
The accuracy measure is a business decision
Total MAPE, average MAPE and weighted MAPE can give the same forecast very different grades. Together with Kalekim we chose weighted MAPE: the error rate of each row is weighted by that row’s sales. That way a large percentage error on a low-selling product does not swamp the overall result. Because the measure was chosen up front and together with the client, every later comparison was made on the same footing.
Structural breaks and validation
The earthquake taught us something else. The model used the months closest to the forecast month for validation. When the earthquake months fell into the validation window, the forecasts for the following months were distorted too. The validation window turned out to be a parameter that has to be chosen deliberately.
At what level to forecast?
Going down the hierarchy, there is more data but repeating patterns are harder to find. Going up, patterns become clearer but the forecast becomes too coarse for planning. At Kalekim, accuracy rose markedly when moving up the hierarchy (company, market). Each market was forecast in its own hierarchy: exports by country, and domestic retail and corporate channels separately.
What separated the two projects?
With the same roadmap, methods and team, the data made the difference. At Kale Seramik three things stood out:
- Concentration of sales. 29 of the 141 DFUs carried 80% of sales. The other 112 DFUs sold sparsely and irregularly, so they left no repeating pattern at the forecasting level.
- Attribute coverage. There were more than 200 product attribute columns, but most were sparsely filled. The data did not hold enough attributes to separate high sellers from low sellers.
- External factors. At the start of the project it was agreed to give weight to external factors, but the factors that went into the model were not enough to explain the result.
Results were good in some months but not consistent from month to month. 34 different method combinations were measured over eight months; three edged slightly ahead of the others, and that was all.
At Kalekim, by contrast, the end of the MVP showed results close to target in some hierarchies at DFU level and room for improvement in others, with clearly higher accuracy at upper levels. Kalekim decided to continue.
That is what the MVP is for
In both projects, the decision to continue at the end of each phase was the client’s. The purpose of the MVP was to show whether a forecasting system was feasible before a large investment. At Kale Seramik the result was measured in the first phase, and the project stopped before any large investment was made. The handover document also set out what would be needed to continue: defining the attribute set that could affect the forecast and filling it in for most materials, and testing different product hierarchies against different customer hierarchies.
At Kalekim two more phases followed the MVP. In the second year the forecast was extended to all products; the models were retrained every month with actual sales and the best model was selected for each hierarchy. That year the forecast entered the S&OP process. In the third year the process became the Kalekimforecast application: data flows from SAP automatically every month, the planner runs the forecast from a screen, and every step is logged.
What to check before you start
Before starting a demand forecasting project, these six questions give an early idea of how the MVP will turn out:
- What share of sales is concentrated in how many products? How sparsely does the long tail sell?
- How complete are the product attributes? Does the data hold attributes that separate high sellers from low sellers?
- At what product and customer level is the forecast needed? Is there a repeating pattern at that level?
- Which measure will accuracy be judged by, and who was it chosen with?
- Are the external factors that go into the model (exchange rates, indices, campaigns) also knowable for the coming month?
- Does the history contain breaks such as an earthquake, a crisis or a process change, and how will validation handle them?
Further reading
- All three phases, Kalekimforecast’s architecture and its monthly cycle: Kalekim demand forecasting case.
- What did not work, and why: Kale Seramik demand forecasting PoC case.
- To talk about a similar project: contact.