My company sells a single product that is a commodity. If you buy it, I can be sure that you will buy it again in the near future from me or from my competitors. The demand is affected by the weather. If we have high temperatures my product sales decrease, and vice-versa.

I have this data per sale:

  • Customer
  • Average temperature in the day of the sale
  • Amount of product bought in a transaction
  • Size of the customer warehouse
  • Price at the moment of the purchase
  • Timestamp of the sale

The problem:

I want, based on historic time series data, to get the Probability that a customer requires my product today. I would like to have a %. Customer X have a 70% of probability of require your product today based on the historic. With that I could get a list of all the customers that today have 80% or more probability of buying and take action with that.

The complexities I see:

  • I have a lot of data because I have a lot of customers but for a single customer I have an average of only 5 purchases.

  • If the customer is not loyal and gets the product from my competitors I have holes that make sales separated by a irregular time spans.

What would be a good algorithm to tackle this problem?

I thought about regressions using time series but I won't get a probability. Maybe transform the timestamp of re-purchase per customer in my training set and try to cluster based on days between purchases.


1 Answer 1


You could frame the problem as survival analysis - predict the probability of an event during a certain time period.

The data quality issues will affect the modeling. You have to decide whether you are fitting a model per customer or a model for groups of customers. Missing data will have to be ignored, explicitly modeling, dropped, or imputed.


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.