 Yeah dear participants, welcome to the course on supply chain digitization. This is jointly being taught by Professor Piyanka Burma, Professor Sushmita Narayana and Professor Devav Brathadas from Indian Institute of Management Mumbai. So, this is lecture 7 of module 3 that is analytics in supply chain management. So, before we proceed for the lecture. So, we will see the summary of last lecture of this module, why demand planning is important. So, in the last lecture we discussed in detail why demand planning is important, then we also discussed the role of AI ML in demand forecasting, specifically in today's context why for demand forecasting we need the AI and ML algorithm. Then we also discussed like what are the various AI ML models are used typically for demand forecasting. So, that is what we discussed in the last lecture. So, in today's lecture we will see a case study and discuss like how AI ML model can be used. In this case specifically we will use one of the ML model and then we will see the result. So, the case goes as follows the demand planning head of a large FMCG company is not happy with the last few quarters forecast. He has been observing a reasonable gap between the actual demand and the demand forecasted by his team. So, as discussed in the last lecture if there is a gap between actual demand and the demand forecasted by his team, then what will happen sometimes you will end up with inventory if the actual demand is less than the predicted demand or you will have a like shortfall. So, if the actual demand is more than the demand you predicted then the customers will not be happy they will not get the desired product. So, they might go to the competitors. So, either you will have like excess inventory at hand or you will end up losing customers. So, that is the result of wrong forecast or if the actual demand is not same to the forecasted demand. So, now with that background so, the manager recently organized a hands on training program on demand forecasting using AI ML for his team. So, he got some idea that in today's context we need to use AI ML algorithm for demand forecasting where customers behaviour are changing, demand patterns are changing very fast. So, therefore, he understood the need of using AI ML for demand forecasting. So, after this training he got some idea that AI ML could be used in like his case as well. So, he is wondering if his team can develop a better demand forecasting model so, that accuracy improves and the gap between actual demand and forecasted demand reduces. So, that is the final aim of any demand planner that if I can reduce the gap between actual demand and forecasted demand. If I can then I am a successful manager because I would be able to plan properly and my inventory holding cost will reduce at the same time my customers also will be happy because they will get the product they want. So, now he immediately asked his team to gather all the relevant data and after debate and discussion with his team he found out the relevant parameters to forecast the demand. So, in this specific FMCG company so, across the country they have many retailers and these are big retailers they place orders to this FMCG company and based on that order they try to fulfil their demand. So, retailers are located in various regions some are located in south some are located in east some west some north so, region wise retailer details we have to capture. Then there is an important parameter balanced credit amount so, that means how much balance credit amount is with them so, this is measured in INR Indian rupees in lakh then location. So, although we are capturing region but within region location is also important whether they are urban the retailer is located in urban area whether the retailer is located in semi urban area whether the retailer is located in rural area and so on. Then we have age that means how old the retailer is if the retailer is very old they will have good influence with the customers customers will know the retailer and they will come and buy the products. Then size of the retail store this is measured in 1000 square feet. So, if the size is bigger more footfall will be there and we are expecting that more demand will come from that specific retailer. Then promotional offer that plays a huge role specifically for FMCG industry if you give some promotional offer that is buy one get one free of course, your demand will go up if you give some discount on a particular product it let us say price discount you are giving. Then obviously, demand will go up then number of holidays also plays a important role if in that particular week along with the Saturday Sunday if you have one more holiday then obviously, customers will go out and buy the products. So, demand might increase during that time period and the last parameter is order quantity. So, from the past data I have from each retailer how much order has come based on the past data I need to find out what would be the order from the particular retailer. So, for each retailer this team of the demand planning team is planning to capture retailer's region retailer's balance credit amount that will be capturing whether they are paying on time or not that means, how much money there they owe to that specific FMCG company location its age the size of the retail store promotional offer number of days. So, we have 1 2 3 4 5 6 7. So, for each retailer I have 7 independent variable and one dependent variable is order quantity. So, I need to find out I need to predict for a specific retailer how much order they will be placing to us if I can predict it properly then I can actually produce them accordingly. So, my production plan will be good and of course, my customers will be happy because whatever quantity they are asking I will be able to give it to them. So, therefore, with these 7 independent variables my job is to predict the order quantity. So, with these 7 independent variables and one dependent variable he and his team collected the data. So, if you look into this data we have 1000 retailer. So, retailer starting with number starting with 0. So, I have 999 that means, 1000 retailers data I have and for each retailer we have their region which region they are from either they are from south or east or west or north. So, I have 4 category of region then for each retailer I have the information balanced credit amount that means, how much money they owe to the FMCG company how much money they are yet to pay back to the FMCG company this is in lakh. Then we have location either it is urban semi urban and or rural then we have age in years like how long this retailer are existed like for how many years they are running the retail shop. Size in 1000 square feet then we have promotional offer 1 0 if the offer was given during that week 1 other way 0 and number of holidays in that week. So, for example, if you see retailer number 1 it is located in east region the balanced credit amount is 12 lakh located in urban area then 6 years old the size of that particular retail store is 2000 square feet and the promotional offer was not given that week and number of all day during that week was only 1. Similarly, if I see 999 retailer number that is actually 1000 retailer the retailer number 1000 in our case region is east balanced credit amount is 24 lakh located in semi urban area 22 years old retail store that means, it has been running for many years the size of the retail store is 57000 square feet huge retail store and the promotional offer was given during that week and in that week I had 2 holidays. So, for each 1000 retailer I have all this 7 parameters and their value then I also have collected their order quantity. So, order quantities are like for retailer number 0 it is 40 retailer number 1 is 0 that means retailer number 0 which is located in south region placed an order of 40 unit retailer number 1 which is located in east region did not place an order during that week retailer number 2 which is located in south region having 11 lakh balance placed an order for 300 units and so on. So, I not only have the values of the 7 independent variables I also have the value of the order quantity now as a manager my job is to predict. So, these are my past data which I have with me. So, using this past data I want to predict or I want to forecast like what will happen in the future. So, these are all past. So, let us say I want to predict if a retailer is located in west region and it is balanced credit amount is 10 lakh and the area is urban area the age 12 years size of the retail store is 8000 square feet and the promotional offer was given during that week and I had 3 holidays during that week. Now I have to predict how much order I will get from that particular retailer that means what will be the demand for the retailer during this week having these characteristics. So, therefore, I need to develop some model which will help me to predict the demand for this particular retailer. Similarly, I have retailers across the country. So, for each and every retailer I have to predict how much order they will be placing to us that means what would be my demand as an FMCG company how much demand I will get from these retailers. If I can predict properly and if my actual demand matches with the predicted demand then nothing like that my inventory holding cost will go down as you have discussed. Similarly, my loss demand cost also go down. Now with that objective in mind the manager in this case came up with the idea of regress entry and develop the model. So, there are many IML models, but their team decided that they will develop a regress entry model accordingly. They started working on that and after developing the model they got the output and the output of the prediction model is presented in the next slide. So, now we will take some time to explain this output and then once the output is explained we will go back and try to explain like how this model has been developed. So, initially I am like presenting the output to you, but how this model has come how this model has been developed what is the background algorithm all will be explaining it after some time. So, first let us focus on their model. So, this is a regress entry model they have developed and if I see I had initially 1000 observation. So, I am using 700 observation for training purpose that is 70 percent and rest 30 percent data which is 300 observation I am keeping it aside for testing the model. So, now with this 700 observation if I have to predict what is the demand of each retailer what is the demand of each retailer then how can I do it. So, if I see in the node 0 I have all the 700 observation and the average of this 700 order quantity is 2270. So, that means if I do not have any information if you randomly pick any retailer and ask me what would be the demand of this retailer I will say 2270. So, how did I get 2270 is nothing, but the average of all 700 retailers order quantity that is simple y bar. So, if I just write it down over here. So, this is nothing, but simple y bar. So, what is y y is nothing, but order quantity. So, I have order quantity of 700 retailers I have taken the simple average of it that is what my best prediction because I do not know any other information. Now, in the second step I am splitting node 0 in two parts using one of the independent variable that is size of the store. So, now I am giving you more information. So, if size of the store is less than equal to 30.5000 square feet then my demand would be 1902. If the size of the store is more than 30.5000 square feet then my demand is 4829. Now, if I compare node 0 versus node 1 and node 2 you will see the difference. So, in node 0 I do not have any information any random retailer you tell me the demand would be 2270 the predicted demand would be 2270 because I do not know any characteristic of the retailer. But as soon as you give me some information some additional information for the retailer in this case I am giving you the information of the size of the store. If size of the store is more than 30.5000 square feet that is size of the store is large then I am predicting that demand is also high. So, they I am expecting that the retailers with more than 30.5000 square feet area would place an order of 4829 that is my predicted demand. If the size of the store is less specifically less than or equal to 30.5000 square feet then I would expect that the retailer would place an order of 1902 units. So, now if I compare node 0 versus node 1 and node 2 you see node 0 my predicted value for all 700 retailers were 2270. But as soon as you give me the information that size of the store is less than equal to 30.5000 square feet I am telling you no demand is predicted demand is not 2270 it is 1902 it has been updated. Similarly, if you give me the information that the size of the store is more than 30.5000 square feet then I will tell that actually the predicted demand is not 2270 the predicted demand would be 4829 units. And how many observations I have I have 612 observations which are having size less than equal to 30.5000 square feet and I have 88 observations which is 100 percent of 700 for which the size of the retail store is more than 30.5000 square feet. Now, the question is can I improvise this prediction can I get better prediction yes you can get better prediction if you give me more information. So, the more information can come like this. So, now in node 1 I have the information that the size of the store is less than equal to 30.5000 square feet. Now, I have 612 observations of that category. Now, can I split this node further. So, I can split this node further using an independent variable called promotion. So, promotion has 2 value 01 if promotion is 0 that means no promotional offer was given during that period if promotion equal to 1 a particular promotional offer was given to the customers. And if we know if promotional offer is given to the customers the demand will go up and that is what exactly you can see in this data also. Now, we split node 1 using the independent variable promotion if you see promotion equal to 0 the demand predicted is 943 a promotion equal to 1 demand predicted is 2360. You can see the demand has increased the predicted value of the demand has increased. So, if I am at node 1 then for all 612 observations I am predicting the demand is 1902, but as soon as you give me the information that the size is less than equal to 30.5 plus the promotional offer was given to that given by that retailer then my demand would increase to 2360 and that is how the demand and the predicted demand value is improvised. Similarly, I can split the node 2 using another independent variable called age. Now, in node 2 I have 88 observations and for all 88 observations I am predicting that my demand is 4829. So, it is relatively high compared to node 1 because node 2 the size of the retail store is high if size is high more footfall will come and obviously, I will predict the demand also will be high. So, therefore, if you compare node 1 and node 2, node 2 average demand is high and that is why the predicted demand is also high. Now, if I use age and split node 2 I am using the age value 17.5. So, if a retail store is having more than 30.5000 square feet area and it is more than 17.5 years old then the predicted demand is 8227. Can you see like the predicted demand jumped from 4829 to 8227, why? Because the size of the store is large as well as its old store. So, many customers knows it old means more than 17.5 years customer knows it they go to this retail store buy it. So, obviously, old store having huge area so demand is also high. So, I would expect that this kind of retailers would place a large order to me and in this case I am predicting that demand would be 8227. Similarly, if I go to the left hand side here in this case I have size of the retail store is more than 30.5000 square foot, but like the store is relatively new age is less than equal to 17.5 years my predicted demand is 2887. So, now if I compare node 0 so node 0 I have 700 observation all 700 training data I have and the predicted value is 2270. So, irrespective of any characteristic if you randomly pick any retailer and ask me what would be the demand I would say 2270. Obviously, this demand will have lot of error compared to actual demand because I am not using any characteristic of that particular retailer. So, therefore, we use like smart criteria and splitted the node. So, node 0 is splitted into node 1 node 2 then node 1 is further splitted into node 3 and 4 and node 2 is further splitted into node 5 and 6. Now, this 700 observations which are at node 0 splitted into 4 part node 3 which is having 198 observation that is 28 percent of the data node 4 414 observation which is having 59 percent of the data node 5 56 observation 8 percent of the data node 6 32 observation 5 percent of the data. So, if you sum it up it would be 700 observation. So, this 700 observation which are at node 0 splitted into 4 node or I can say 4 clusters node 3 1 cluster node 4 1 cluster node 5 1 cluster node 6 1 cluster. So, all the retailers which are falling into node 3 for those retailers my predicted demand is 943 all the retailers which are falling into node 4. So, who are those retailers who will fall into node 4 the retailers whose size is less than equal to 30.5 thousand square feet and they are giving promotional offer during that week and the demand is 236 that is predicted demand. Similarly, all the retailers who are into node 5 I would predict the demand is 2887 all the retailers who are into node 6 I would predict the demand is 8227. So, who are the retailers can you say who are the retailers who are into node 6. So, the retailers are those whose size is more than 30.5 thousand square feet and age is more than 17.5. So, now I have used 3 independent variable first size of the store then second promotional offer whether promotional offer or even by the retailer or not and third age of the store how long they are into the existence. So, using these 3 variable I can predict the demand or I can predict the order quantity by the retailer. If I increase the depth of the decision tree if I further split node 3 node 4 node 5 then obviously, my depth of the decision tree will increase and my prediction will be much better. Suppose, this is the decision tree or the regression tree to be specific which you have built and based on this regression tree you want to predict. So, you have a retailer let us retailer A which is located in west part of the country balance credit balance credit amount is 10 lakh rupees they are located in urban area age of the retail store is 12 years old the size is 8000 square feet and the promotional offer was given during that time period I have 3 holidays during that week. Then the question is what would be my expected demand like how much order this particular retailer that is retailer A would place to me. Can you predict this data or the demand based on this decision tree yes I can. So, first I have to see the size of the store size of the store is 8 that means I am here. So, I am going into node 1 because in my case retailer A size is 8000 square feet. So, node 1 is cluster of those retailers whose size is less than equal to 30.5000 square feet. Now, next I have to see promotion was given promotion value 1. So, I will move to this part. So, I mean node 4 so node 4 predicts the demand is 2360. So, what would be this value? So, this value will be 2360. So, my predicted demand for this retailer is 2360. So, that is how for any retailer across the country using these 3 parameter size of the store promotion and age you can predict what would be the demand of those retailers. So, now if I summarize I have 4 node each like node 3 node 4 node 5 node 6 given the data of any retailer it will fall either in node 3 or node 4 or node 5 or node 6 and based on that I can predict. So, if I just summarize I can create a business rules out of it the first business rule would be the size of the store less than equal to 30.5000 square feet promotion is 0 demand is 943. So, that is what we have written size of the store that less than 30.5000 square feet promotion is 0 predicted value is 943 matching. Now next size of the store less than equal to 30.5000 square feet promotion was given for those kind of retailer demand is 2360. Size of the store less than 30.5000 square feet promotion was given demand is 2360. Then next size of the store more than 30.5000 square feet age less than equal to 17.5 years demand is 2887 with this characteristic. Now we have last criteria size more than 30.5000 square feet age more than 17.5 and then demand is 8227 and I have this particular characteristics. So, I have four value of the predicted demand depending upon the size of the retail store and the promotional offer and the age of the retail store I can predict the demand of each of this retailer and then I have the for that prediction also which we discussed in classification tree. So, for first predicted demand 943 as the support of 28 percent. So, how do you decide support? Support means how much observation you have. So, in node 4 I have 28 percent observation in node 3 I have 28 percent observation in node 4 I have 59 percent node 5 8 percent node 6 5 percent. So, that is what my supporter if support is high if support is high specifically for these two node node 3 and 4 in my prediction I will have more accuracy that is what this support says. So, in the next class we will see how you can also build the similar kind of decision tree on your own. So, thank you see you in the next lecture.