I have a data set showing whether or not people bought ice cream from a specific stand and whether or not they ended up being return customers.


where has_visited is 1 or 0 based on whether they have ever visited that ice cream stand, and repeat_customer is a 1 or 0 based on whether they had come back for a second visit or more.

What would be a good method to predict whether or not someone will be a return customer given that they have already been to the stand previously?

  • $\begingroup$ There's not much to go on here: you only have the total number of visits to use for your prediction. Have you studied its relationship to being a repeat customer in your dataset? What does that suggest? $\endgroup$ – whuber Aug 22 at 19:32

Note that for each customer, the only information you have is the total number of visits ("has_visited" and "repeat_customer" are both functions of the total number of visits). Since you don't have any other distinguishing information for each customer, it stands to reason that you will have to make the prediction in the same way for each customer! You can easily calculate the fraction of customers that were repeats. If this number is, say, 5%, then most customers are not repeats and the "optimal" prediction will be just to say that no customers will be repeats--you'll only be wrong 5% of the time! If it's 90%, then the opposite applies.

You can also use a randomized predictor that randomly predicts "repeat" 90% of the time and "not repeat" 10% of the time for that last example. The important point is that without other information on the customers (e.g. age, gender, income), you can't do any better than simple guessing like this.

  • $\begingroup$ That was what I figured, namely that we need demographic information to even make this prediction (which thankfully we have, but I merely redacted it). $\endgroup$ – rosstripi Aug 22 at 19:45
  • $\begingroup$ If you have such data, the simplest general solution is a logistic regression, which is easy to learn about online and implement in R or Python with sklearn. $\endgroup$ – Sheridan Grant Aug 22 at 19:51
  • $\begingroup$ Could "previous visit" be used as a dummy variable in a regression equation if we want to predict likelihood to visit? $\endgroup$ – rosstripi Aug 22 at 20:20
  • $\begingroup$ I just realized you have data for customers with zero visits, which actually doesn't complicate things too much. The problem with using "previous visit" as a dummy is that no one with no previous visit has ever had a return visit by definition, so the estimated probability for "no previous visit" will be zero. Then the estimated probability for "yes previous visit" will just be the overall return probability among those who have visited at least once, which brings us right back to my original answer. $\endgroup$ – Sheridan Grant Aug 24 at 0:58

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.