I'm working on a project to predict future sales for our company's products so that the supply chain can have better idea how much to restock.

Detail about the model I'm working on:

Model: LGBM (from Darts library)

Features: Past sales, calendar information, price, some other external features, and the one that I have question on -- inventory level (exact number of inventory from one day before).

Prediction Window: One step, but recursively predicting 35 days forward.

My question is, is it even legit to use inventory level as a feature to predict sales? If so, how to use it properly?

Inventory level certainly contains some information about sales: like 0 in-stock usually means 0 sales; low stock may drag the sale down; restock after a long time of out-of-stock status will cause the sale to climb up gradually instead of jumping up suddenly (in my case). However, during prediction, there's no way for us to pre-know the inventory level for each day. I could certainly use some logic to simulate inventory dynamic, but in that case, there's no way to compare the true and predicted value because the inventory data is not even real. Using the real inventory data will also raise my alert that I'm giving the model something that it probably shouldn't know at the time of prediction.

So, can I still use it, or does it make sense to still use it? If so, what's a proper way to process this data so I could still use it in the validation data? maybe categorize it?

Looking forward to any helpful thoughts and suggestions. Thank you!


1 Answer 1


Yes, it is legitimate to use it as a feature.

demand side

You have correctly identified some of the issues.

0 in-stock usually means 0 sales;

and out-of-stock for an extended period will change customer habits / preferences.

It's unclear how much inventory information is exposed to your customer base in a way that could change their purchasing behavior. For example, if you have a bunch of geographically dispersed shipping warehouses but only a handful of some SKU in stock, that suggests that most warehouses have zero on hand. Which could inflate number of days to ship the SKU to a buyer address, potentially affecting the buying decision.

When your model observes "low" stock levels, it is entirely appropriate that it infers an impact on future sales.

You might want to explicitly model demand side effects, such as number of lost sales due to risk of zero inventory, or number of lost sales due to changed preferences following extended non-availability.

supply side

As data scientists, we believe there is a Generating Process out there in the world, imposing structure on the observables it produces, and that our models can learn that structure.

Many people beyond customers are participating in that process. This includes the folks placing re-stock orders, perhaps with knowledge of an upcoming special sales event, of seasonal patterns, or of a need to hoard some commodity before a predicted supply chain shock. Inventory levels might be the only way your model observes the domain expertise of these SMEs.


It's unclear to what extent your model's prediction output affects those experts or directly arranges for re-stock orders. Training on such feedback is not legitimate; it is a loop that you wish to sever. (Which likely motivated asking the question in the first place.)

To the extent that stock levels reflect true statements about the outside world, they may offer valuable system knowledge that you can learn from. To the extent that such levels are a side effect of a model's outputs in previous cycles, they are at best a distractor variable.

You may be able to break such cycles by interacting with experts differently. Ask them for "predicted sales next month" rather than for "number of units to re-stock next month" and you might gain an informative input feature.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.