Unfolding the universe of possibilities..

Dancing with the stars of binary realms.

Want to Improve your Short-term Forecasting? Try Demand Sensing

When traditional forecasting approaches plateau in accuracy, how can we drive further improvements?

Photo by JJ Ying on Unsplash

Introduction

Demand forecasting is a process that estimates an organization’s sales over a certain horizon in the future. Short-term demand forecasts typically look out over 1–3 months, while mid-term forecasts can range over 6–18 months. Long-term forecasts often go up to 3–5 years. Forecasting helps the business decide on what, when and how much to sell, inventory to hold, and where to invest in capacity for the future to meet a dynamic customer demand. Companies usually rely on historical trends overlaid with inputs from customers, while also factoring in promotions or fire sales, to create a demand forecast.

Demand forecasting is important for several reasons. It sits at the top of a Sales & Operations Planning (S&OP) process where the forecasts generated in this stage trickle down to other stages including supply planning, production scheduling, logistics planning, and inventory optimization. It is critical for the demand forecast to be as accurate as possible to avoid costs associated with too much or too little inventory. Over-forecasting can lead to excess working capital being tied up in inventory. On the other hand, consistent under-forecasting can stock out customers or lead to a scramble to make orders using more expensive raw materials and ship on short notice with more expensive transportation. An accurate plan helps avoid these situations by driving the manufacture of the right quantity of product at the right location at the right time, and facilitates high service levels and lower costs of storage.

Challenges in Forecasting

“Prediction is very difficult, especially if it’s about the future.”

This quote is oft attributed to Niels Bohr (there is some debate on whether he actually said this), one of the leading physicists of the 20th century. While this is a light-hearted take on forecasting, it underlines the intrinsic challenge with forecasting. In addition to not knowing the future, there are other challenges associated with forecasting approaches.

· Changes in the business environment — for instance, substitutes may replace a product, driving its demand down. Alternatively, new applications for a product may cause demand to go up compared to historical trends.

· Shifts in business model — an organization may change its operating model and business strategy. For example, a chemical company may choose to shift their business from commodity chemicals to more specialty products, and so the historical demand patterns may not hold anymore.

· Data availability — historical sales data, customer and product hierarchy data, and real-time orders data may be stored on disparate systems.

· Data quality — this may include issues such as inaccurate data due to entry errors or data being captured at different and inconsistent granularity across data elements.

Forecasting Approaches

Photo by Chris Liverani on Unsplash

Forecasting can be based on quantitative or qualitative methods. Quantitative methods are mostly time-series analysis where we attempt to capture trends over time (e.g. growth, seasonality) based on historical data. In other quantitative instances, we may build econometric models correlating demand forecast to business relevant factors. With a qualitative approach, we rely on ‘wisdom of crowds’ and attempt to estimate the future based on collective option of experts or surveys. There are several insightful resources on forecasting techniques that are available online; a sampling is shown below:

The Ultimate Guide to Demand Forecasting Methods: Boost Sales and Optimize Inventory – nexocodeDemand Forecasting: Everything You Need to KnowHow to Choose the Right Forecasting Technique6 Types of Demand Forecasting and Projection Benefits

Short-term Demand Sensing

Short-term demand sensing is a forecasting technique that utilizes leading indicators to predict product sales over a near-term horizon. It uses a combination of historical data and real-time information to make predictions at a daily or weekly level. In doing so, it captures some of the key dynamics in the market, especially in volatile times. As such, it helps planners adjust their production and logistics plans to a more refined and accurate forecast, thereby increasing the resiliency of the supply chain and reducing inventory and transportation costs. There are a variety of online resources on demand sensing — a few are listed here:

https://medium.com/media/1c8c7b5794cd72d1fd06c7efeefc56d2/hrefWhat is Demand Sensing – AI/ML Solutions and Services | Premier Google Cloud PartnerArticle – Kearney

Demand sensing is expected to have a high economic value (in terms of cost savings or avoiding revenue loss) simply due to the sheer magnitude of shipments. Due to the granularity of the predictions, and the frequency of refreshes, demand sensing can be data and computationally intensive. But with more computational power available to consumers, tractability is expected to be high. Demand sensing results are mostly high in explainability since we typically use linear regression-based models for these applications. More often than not, the results can be analyzed to explain the predictions clearly to stakeholders. The forecast update recommendations from demand sensing are actionable since it is an organization’s internal decision to change production based on forecast changes. Demand sensing applications are also mostly sustainable in terms of input data refreshes since they rely on real-time order data generated on a daily basis.

A Simplified Demand Sensing Approach

Demand sensing relies on relevant leading indicators to estimate a sales forecast. The rate at which customer orders are placed could be one such leading indicator of near-term demand. In some industries, such as the petrochemical industry, customers typically place orders to be booked in each month several weeks ahead of time. In this article, we talk about a demand sensing approach based on customer orders for a chemical company.

In this approach, the premise is that if orders are placed at a faster rate early on compared to historical order placement trends, the final monthly demand is going to be high and vice-versa. The proposal is to augment the traditional forecasting process by performing the customer ordering trend analysis in the middle of every month to estimate product demand for the next month. This early insight would be very helpful to supply chain and product managers to make decisions on adjusting production and pricing. The analysis would also identify customers that were likely to place orders below their forecast making the remaining volume available for customers that wanted additional product over their forecasted volumes. This would enable proactively ‘swapping’ product between the two sets of customers reducing order blocks and delays and enrich the customer experience.

To build a machine learning solution for the Demand Sensing use case, we follow a series of steps including data gathering, exploratory data analysis, data processing (cleaning and feature engineering), model development and refinement, actionable insights, and recommendations. The main objective is to predict the current and next month demand at a given granularity (e.g. product family, customer category) based on customer order attributes. Details for each step are listed below:

a. Data gathering — based on what’s typical for this use case in a commodity company setting, we assume that each product (or product family) has dozens or hundreds of customers that place orders in advance. To capture annual and seasonal trends in customer orders, we collect data for at least the past 36 months. We gather sales orders that include data on requested volumes, sales order date, demand booking month, customer information including customer category and geography, product attributes including product family, market segment. We start with a demand booking month and look for total product volume requested in the sales orders on a daily basis (workdays excluding weekends and holidays) over a two-month period starting from the first workday of the prior month (CM-1) to the end of the demand booking month (CM). This is assuming no orders are placed before that date (1st workday of prior month). We also need to remove cancelled orders or returned orders from the analysis. Table 1 shows the sample data in a dataframe.

Table 1. Sample data from historical sales orders in a dataframe format

*WD — Workday

b. Exploratory data analysis — we start with getting a sense of size of data (rows and columns) and number and type of features (numerical vs categorical). We also identify number of null values in each column. We visualize the numerical columns (via histograms, boxplots) to look at shape of the data (including mean, median, skewness, outliers), and the categorical data (via bar charts) to confirm unique values and identify any erratic values that need to be addressed.

c. Data processing — in this step, we remove outliers (e.g., negative values or extremely high values of numerical columns). We also select features and perform feature engineering. For this use case, we select features that are at a higher aggregation than the predicted variable. For instance, if we predict product family demand, we select market segment, geography, cumulative order volumes, and monthly baseline sales forecast as the predictor features. Cumulative orders by a given workday (Table 2) are derived from daily order volumes as part of feature engineering. Figure 1 shows an example of how cumulative orders may vary by workday.

Table 2. Historical orders dataframe (with feature engineered attributes)Figure 1. Cumulative order percentage by workday for select months in a year

d. Model development and refinement — a multiple linear regression is recommended for this use case. This is expected to be ‘piecewise’ solution, where we have different regression functions for each workday. With 36 months of data, hundreds of customers for each product family, we would have thousands of data points in the training set for each product family. We start with defining a loss function to help us build the model that provides the most accurate demand forecasts. We choose several accuracy measures including mean absolute error (MAE), mean absolute percent error (MAPE), and R2 and test performance of different models across these metrics (we want the R2 to be high and the errors to be low). The raw error is simply the difference between monthly demand prediction and historical actuals at the product family level. In terms of data preparation, we first split the data into training set (80% of the data) and test set (20% of the data). The missing or null values are treated separately for each set to avoid data leakage. If the missing values make up a majority of a feature, we may drop the feature entirely as it yields little predictive power. If null values are present in only a few rows, we may drop rows with missing values. We may also impute missing values with the central tendencies such as the median of the column if it is numerical, or the mode if it is categorical. Further, we also convert categorical variables into numerical format with one-hot encoding. To scale the data for input into a linear regression model, we divide the dependent variable (monthly demand prediction) by the baseline sales forecast and cumulative orders (independent variable) by the baseline sales forecast. The regression model coefficients provide the significance of the features in explaining the variation in the predicted variable.

e. Actionable insights and recommendations — the demand predicted by the AI application may be higher or lower than a baseline sales forecast. To explain the results to stakeholders, one approach would be to compare historical order curves with real-time orders (see Figure 2).

Figure 2. Comparison of cumulative order percentages: historical vs real-time

*Only 3 months of historical cumulative order percentage curves are shown here for illustrative purposes; in a real-world discussion, we would include at least 12 months of data.

In this figure, the historical cumulative order percentage curves are plotted as solid lines, while the real-time cumulative orders (as a percentage of the baseline sales forecast for next month) are plotted as the dotted line. We can see that in the historical months selected, around 12% of total demand is ordered by the 10th workday of the prior month but we are trending at ~5% of the forecast indicating the demand is coming in softer than expected for the baseline forecast. For this example, with stakeholder buy in to update the demand forecasts, we can inform decisions on decreasing production for the product family in question while identifying customers that are ordering lower than what they provided as forecast. In general, the predictions can be run daily to provide signals to manufacturing on production and inventory and to sales teams on demand weakness or strength. The AI/ ML models can themselves be re-trained once every quarter or at the time of business re-structuring.

Economic Value Estimation

Photo by Ibrahim Boran on Unsplash

A way to think of monetizing forecasting inaccuracies is in terms of lost revenues from stock outs and increased storage costs associated with excess unsold inventory. While fluctuations in forecast can balance out over longer periods of time, a consistent bias in forecasting can lead to an unbalanced portfolio of products. The lost revenues from short-term stock outs can have an impact on the business in the long-term if customers choose to leave the organization permanently in favor of competitors. We illustrate lost revenue through a simplistic example in Table 3 below where a key assumption is that the organization does not have sufficient inventory to cover for forecast inaccuracies. This table provides the baseline forecast (without the AI application) and actual demand from customers on a monthly basis for 10 product families: PF1 to PF10. The price per product family is also provided. The magnitude of these numbers is representative of a commodity chemical product.

Table 3. Hypothetical example to illustrate lost revenues due to inaccurate forecasts

We can see that for some of the products, we are over-forecasting (Forecast > Actuals) and for others, we are under-forecasting (Forecast < Actuals). For the under-forecasted products, we assume lack of inventory to cover this shortfall and calculate the lost revenue by multiplying the price with the shortfall. The total lost revenue is estimated to be ~$58MM. With an AI enabled application to sense the future monthly demand using daily real-time orders and update the forecast and make the right volumes of products, we can reduce this lost revenue. Even with 20% improvement in the forecast error (not atypical of such applications), the organization’s lost revenue reduces by $11.6MM per month.

In Closing

Short-term Demand Sensing using real-time customer orders can be a step up over conventional forecasting methods as it makes use of real-time information to upgrade the accuracy of the forecasts. We’ll note though that it may not be applicable to all use cases or business situations. It works well when there’s some regularity in ordering pattern and orders are placed in advance. This technique works best when combined with market intelligence to understand the business insight behind observations. The approach doesn’t translate to forecasting beyond 6–8 weeks as customers usually do not place orders that far in advance.

The method described in this post can also be used for other purposes. For example, we can use this approach to estimate the deviation between expected demand and actual orders placed for each customer/product combination. This can help identify customers for further investigation who have ordered too little or too much product volume as a percent of their baseline sales forecast compared to their historical ordering pattern.

Finally, we would want to put mechanisms in place to take action once the updated forecast is available. This may include ramping up / down production or following up with customers who have exceeded their forecasted allocation or not lifted any volumes yet.

Thanks for reading. Hope you found it useful. Feel free to send me your comments to rk********@gm***.com. Let’s connect on LinkedIn

Want to Improve your Short-term Forecasting? Try Demand Sensing was originally published in Towards Data Science on Medium, where people are continuing the conversation by highlighting and responding to this story.

Leave a Comment