I am attempting to create a demand forecasting model in python to predict future sales of a particular category of product, using historical sales data.

We are a B2B company, which means that we often get large orders at random times in a year, and there are other periods of no orders.

When using data for the past 5 years, the pattern looks a bit odd. from 2014 to 2016 there is an upward trend, followed by a downward trend.

enter image description here

When I attempt a linear forecasting method, the training set seems to predict the test set fairly well based on the graph. However, the metrics show that the projected sales count is off significantly.

enter image description here

enter image description here

What is the reason for such a huge error rate?

I realize that perhaps the best model for time series such as this would be something like SARIMA. I tried attempting ARIMA models, but because of the nature of the business (B2B) and very few data points available, SARIMA spits out too many errors. (for example, while trying to smooth out data for trend and seasonality, there are lots of logarithmic transformations. This removes resulting Nans and -infs, which leaves the data with almost zero data points.)

For a B2B company with very limited data points on purchase of a particular product (out of 5 years/1825days, only about 400 days when sales occur, for example), is it possible to build a reliable demand forecast model?

sales count of a particular product and the date of purchase

Is it possible to use linear regression to forecast future sales without the model projections being significantly off?

In summary, I would like to know if:

  1. it is realistic to attempt reliable demand forecasting for a B2B sales with limited sales info.

  2. What would be the best approach to forecasting B2B sales of particular products?

  • $\begingroup$ If your first graph is the demand, it is not odd at all : There is a definitive cycle which is more or less but not exactly yearly. The first thing is to explain this cycle (products release, climate,...), then you can take it off and forecast the decycled demand. By the way, you may try use cumulative demand (by summing up previous demand up to time t), the variation will be less sensitive. $\endgroup$
    – AlainD
    Aug 31, 2018 at 8:49
  • $\begingroup$ Hi! I'm working in a similar context ( b2b but with large product databases) and on the exact same problem. Same weird pattern with huge orders from time to time. if you want to tell me your progress on this problem, i'd very happy to hear it. Thanks $\endgroup$ May 24, 2019 at 13:21

1 Answer 1


I would suggest to look at intermittent demand models, I think for such type data ARIMA type model is an inappropriate model.

Intermittent Demand model first proposed by J. D. Croston and I would suggest to look at that paper too. Here, you can find a short note in intermittent demand forecasting.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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