Machine Learning Models for Demand Forecasting
Artificial Intelligence and Machine Learning (AI-ML) are gaining popularity in wider areas – Advanced Driver Assistance Systems (ADAS), Computer Vision, Speech Recognition, Robotics, Fintech, Medical Applications, Supply Chain, Logistics, and many other areas. Every industry is eager to adopt AI-ML in at least one of their practices and automate their systems. Even Supply Chain practices are rapidly transforming and digitalizing by applying AI-ML technologies.
AI-ML concepts can be applied to various components of the supply chain – demand forecast, logistics &transportation, inventory management, production planning, and procurement.
In this article, we will discuss one of the areas of the supply chain, which is an elephant in the room. However, it can be easily addressed by Machine Learning. It is an essential component of the supply chain; however, many industries are still struggling with it or using rudimentary methods. If performed accurately, many issues which planners face in the later stages can be tackled effectively. This value is used for production planning, inventory management, procurement, and eventually logistics and transportation. It is Demand Forecasting.
Demand Forecasting
Demand forecasting is the process of using predictive analysis of historical data to estimate and predict customers’ future demand for a product or service. Statistical methods of performing forecasting are Simple Moving Average, Holt’s Winter Method, Croston Method, and Syntetos-Boylan Approximation (SBA). Croston and SBA are majorly used for intermittent forecasting.
The Machine Learning approach to forecasting involves –
- Time Series Analysis
- Regression Modelling
- Deep Learning Modelling
In this blog, we will focus on Machine Learning Approach for Demand Forecasting. What all data pre-processing steps can be employed? Which models can be built under each approach, their benefits and limitations? How to perform multivariate forecasting under these approaches? What KPI metrices can be used? And how can the model check and autocorrect its output?
Data Pre-processing
It is an essential approach in any ML project. However, it gets tricky when we are dealing with Time Series Data. We need to pre-process the data ensuring that trend and seasonality are not getting impacted. Following pre-processing can be performed –
- Anomaly Detection & Correction – It is the identification of rare events, items, or observations that are suspicious because they differ significantly from standard behaviors or patterns. Anomaly in Time-Series data can be tricky as trend and seasonality must be considered while finding anomalies.
- Breakpoint Analysis – Breakpoint analysis is a way of looking at demand data to determine when there are shifts or breaks in demand levels. This can eliminate previous historical data which are no more significant.
- Seasonality and Trend Calculation – Seasonality and trend can be calculated using seasonal_decompose. This gives an idea about the overall trend and any seasonality.
Time Series Analysis
ARIMA is a way to perform Time Series Analysis. There are few variants of ARIMA –
- ARIMAX – Standard ARIMA with an additional feature to train using exogenous factors.
- SARIMA – Seasonal ARIMA
- SARIMAX – Seasonal ARIMA with exogenous factors
- Auto ARIMA – Automatically tries to find best fitted ARIMA considering seasonality and exogenous factors
Pros
- Accuracy is very high
- Easy to implement
- Can generate a model with few data points. In a case, a minimum of 12 data points were used to generate this model
Cons
- In a few cases, it fails to identify trends or seasonality
- In some cases, it identifies the incorrect trends and extrapolates the data exponentially
Regression Modelling
Regression models like Random Forest & XGBoost can also be used to forecast demand for the future. In our case, XGBoost has outperformed Random Forest. 24 data points are used as input and the 25th data points as prediction; the entire data set must be broken down into sets of 24+1 values. A minimum number of inputs in the training set should be 24 (if it is monthly data) to identify seasonality.
Pros
- High accuracy
- It can automatically identify seasonality and trends
Cons
- Needs more data points at least 30 (in this case) to perform this regression.
Deep Learning Modelling
ANN and LSTM models can be used for forecasting. LSTM gives better results as compared to ANN. In LSTM, the training set should have 24 inputs to predict next month’s output.
Pros
- Its accuracy is better than XGBoost Regression
Cons
- It needs several data points
Causal Factor Integration
We have added causal factors which have a strong correlation with demand data. These causal factors are – Holiday, Discounts Data, Promotions, and Price Change Points.
Auto-Correction Algorithm
Once the final forecast is generated, the algorithm performs a sanity check of the output. It calculates trends and standard deviation of the output to check if the algorithm is fit properly. If there is any issue in the output, the model calculates the forecast using Statistical Method – Holt’s Winter Algorithm.
Conclusion: We have used MAPE (Mean Absolute Percentage Error) as our KPI. We are adopting these principles can achieve accuracy up to 85% and for products, it is above 90%.
Author:
Shrestha Priya
Lead Consultant