Black Magic method of Demand Planning
Ravi Prakash
Senior Manager , Planning and Business Systems , Johnson and Johnson , APAC , MedTech
Le Verrier ( French Astronomer) began studying the motion of Mercury (during 1843) and published a report . In 1859, Le Verrier was the first to conclude that the slow precession of Mercury's orbit around the Sun could not be completely explained by Newtonian mechanics. No one challenged the Newton's law of gravity then as it was still able to 'largely' explain the orbit of Mercury . About six decades later , a more complex theory developed by Einstein predicted the path of orbit as observed by astronomers . You may be wondering what astronomy has to do with demand planning . A natural phenomenon or an event or a process can be explained by different theories/algorithms/functions . Usually we prefer the one with simplest explanation but it does not mean that it is 'better true' estimate than others . In business world , we have a knack for simplicity and we always look for a balance between the two( Algorithm complexity and outcomes/explanations ) . Let us hold on to this idea and revisit it few paragraphs later .
In Demand Planning , there are plethora of algorithms to choose from . Exponential Smoothing , Moving Average , ARIMA/SARIMA , Vector Auto regression , Machine Learning Algorithms( Shallow ones) , Deep Learning RNN and LSTM , Facebook Prophet , AWS Forecast etc . As a demand planner or a reader you may not be familiar with each of these but in my previous articles i have covered some them in quite depth . Feel free to refer in case interested . Further part of this article is only going to dwell upon Deep Learning approach of demand planning ! Unless you have been exposed to basics of Deep Learning , you will struggle to understand what is going on but then that is the path we are taking today. Are you ready to get lost ?
Time Series Predictions using Recurrent Neural Network LSTM ( Long short-term Memory)
What is LSTM ? Look at image below . That is basic building block of LSTM , it has three type of gates and activation functions used are primarily Sigmoid and Tanh .............Any recursive function can ...................................
Let us simplify . Our brain is unique and powerful . It remembers the context and previous sentences while we are reading the new line . For example , let us play a word prediction game .
'I had high fever and was not feeling well . I logged into workday portal and applied for ........'.
Attempt 1 - Just read the last line like I logged into .....and try to guess the word appropriate for blank space .
Attempt 2 - Read both lines and suggest the word
I am sure that most of us will say 'sick leave' . Attempt 1 will throw up many options but once we follow second approach we are almost predicting the right answer . The message here is - we have short term memory . We remember what we have read few lines earlier , what was context and use it to understand the meaning of next line . Hence a very simplistic definition of LSTM ( which you should never quote any where ! ) is that it is a type of neural network which build 'this' capability into network ! It a neural network with memory and yes it is used by algorithms that prescribe words while you are typing on your laptop or mobile . We would not get into math involved as it will kill the fun part . Since time series values are dependent on previous values , LSTM finds its application in demand planning domain as well . Feel proud that you understand LSTM now !
DATA , Prediction and Overview
For demo purpose , we will use Tata Steel Share prices . Data is in daily time buckets and values are in INR . We will split it into Train ( Jan to March ) and Test set . Below are the steps we need to follow as unlike ARIMA etc original data cannot be feed into LSTM network-
领英推荐
I don't intend to get into details of programming but it is not easy and it is almost sure that you will get lost in what is going on here . We can definitely create a software that automates most of these transformations but it is like Black hole . We know what is going inside but rest is mystery . For example , we will peep into the step where we have to convert time series data into supervised learning problem .
Assume , we have observations for last 16 days of temperature( Minimum and in Celsius) in Pune for month of Dec '22.
Temp =[15, 18, 17, 20, 14, 12 , 16 ,19, 14, 15, 18, 19 , 14, 15 , 18]
When we have to formulate a problem for Supervised ML application then we need to transform data/observations in such a way that we have features ( represented by X , essentially a data frame of rows and columns) and labels ( Targets ,y) .
Hence our ML algorithm reads above table to learn the parameters . Ideally in real world , you would be using Keras to execute mentioned steps .
LSTM model almost predicted with 100% accuracy ( Don't try this in real life as you will definitely loose money . Share markets are more driven by future rather than past ). How did it managed to do so ? One answer is -Obviously , algorithm learned it parameters through Back Propagation( MSE as a cost function ) and used the same to predict the price for April . But how many planners are actually able to visualize it ? How do you interpret weights and biases and too when these are in thousands ? In real world , we want to predict futuristic values but are equally eager to know what is driving these numbers. Probably this interpretation is not possible and for time being even if we assume that it is feasible , there would be scarce resources in any organization who could read it .
Just to tie it back to where we started , we have ARIMA , Shallow ML algorithms etc which offer better interpretability and that should be go to choice in corporate world rather than Deep Learning LSTM approach . Like Einstein's relativity theory Neural Networks are capable of representing or computing any function but it has its own cons . It has immense potential and may be in near future , Deep training would become the main algorithm but it is not happening very soon.................
Business/Demand Planning at Henkel
2 年Very interesting. Thank you.