Does anyone know of literature or tutorials/examples that uses pymc to help with building a “what if” tool to simulate a supply chain?
This tool would theoretically be able to give a distributions of possible scenarios to questions such as, “what happens if my forecast is off by 100 units or under performs by 1000 units? What’s the likelihood we will stock out?”
Thanks. I have read that one.
@RavinKumar has been talking through HMMs in his most recent book club, some of which are supply chain-related. Probably not exactly what you are looking for, but the series is pretty good.
It sounds like you want something related to inventory dynamics?
You could definitely do everything in the linked lecture using only PyMC, you’d just need to specify a demand function and a restock schedule, then you could run simulations that answer the types of questions posed in the OP.
This exact problem is how I got my start in Bayesian stats. I gave a pydata talk on the concept here. In practice Ive used much more complicated models at SpaceX and sweetgreen to help inform stocking strategies, expedites and the like.
Any specific problem you’re working on?
Thank you. I will watch this.
I need to build a global supply chain to be able to answer “what-if” questions around dropping/increasing safety stock, adding/deleting warehouse locations, forecasting over/undersell and what that does to inventories with current manufacturing workorders, etc. Over 1000 products in over 130 countries sold.
I used a bayesian model in our new forecastins system and it is doing well. I’m trying to the same with our inventory system.
Alright. I’ve watched it. A very good talk and thank you for posting it. It seems like I need to do the newspaper problem on a slightly larger scale.
Would building a model that simulates my company’s supply chain be like a Bayesian network?
For example, if a manger comes up to me and asks, “will we go stock-out in Korea store number 8, if we lower our safety stock at the Korean regional distribution hub?” Or, “if we switch to this new shipper whose transit lead time is one day longer than our currnet, how much will we have to increase safety stock?”
Is it a bayesian network framework that helps answer that?
For example, below is a graph depicting the supply chain network from the customer demand signal to our manufacuring facility (80320) to our warehouse (80322) to our regional warehouse in Korea (80073) to all of our Korean Stores (KR…). Assuming our demand distribution and lead time time distribution crudely depicted on the graphic, could we run a model based on the below information and see on hand inventory, in trasit inventory and probably stock outs at each store, being driven ultimately by demand?
Yes it can help with that. This was the exact use case I had for building SpaceX rockets where each node was an assembly procured either from a supplier or built in house.
You can estimate the lead times for each node, then use posterior predictive sampling to assess the duration of the entire network cumulatively. There are some assumptions like independence etc but it sounds like your situation this isn’t too bad of an assumption.
I’m starting to get some language around this so hopefully this is my last question. Can pymc and bayes in general do discrete event simulation? Essentially I believe that’s what I wanted to know the entire time but just learned the terminology.
The short answer is yes,
The longer answer is bayesian methods are quite powerful in estimating the parameters needed to create a reliable and accurate DES simulation, such as processing distributions, lead times, and other variability.
From there you can plug those into any other DES. Its funny you ask this because when before I knew bayes I was using Arena and Simio and they would fit a chosen distribution to your data using MLE. Funny timing you asking because I was just using Simpy and Bayesian methods at Google yesterday to do exactly this.
Alternatively if you don’t care about discrete events but cumulative lead times you can build a supply chain and manufacturing network in PyMC directly, condition all the edges and nodes in your network, and use posterior predictive sampling to get the cumulative lead times.
This, and the more general topic of Bayesian Decision Making, is underrepresented in the PyMC examples. I’m sure that any contribution of clear examples would be very welcome in the pymc-examples repo.
I’m very interested if an example of this is available to do it in PyMC.
@RavinKumar thanks a lot for the great video. I am a supply chain manager myself and are started to look in use cases to apply bayesian statistics. As we have more a python environment in our company I came across pymc.
I am not sure if I should open a new thread or append some use cases in this thread. Please advice.
I work in the semiconductor industry, where the supply chain is heavily influenced by extremely long (production) lead times and fluctuating short-term demand. With the onset of the COVID-19 pandemic, the demand signals became highly unpredictable. Over the past few years, our customers have significantly overstated their demand for semiconductor allocation. Do you have any suggestions on how to handle these exaggerated demand signals? I’m hesitant to simply disregard them as outliers without a clear approach.
I’m developing a demand model now where multiple items have sporadic, outlier type demand.
We first correct the outliers and use corrected demand to model normal sales patterns. Then we develop models to account for fluctuations in actual demand with the target being the difference between the actual demand and the predicted normal sales demand (residuals).
So we can model promotions, price changes etc by taking the residual prediction and adding it to the normal sales pattern prediction.
Does that make sense?
Great discussion here,
Generally speaking there’s a couple of strategies
- Remove or “correct” the data manually
- Use a restrictive prior to discount
- Use a flexible likelihood to accommodate
I write about this in a chapter of my book
I also will be giving a PyMCon talk that will include this based off of my experience at SpaceX where this occurred frequently! Stay tuned for that one