Suppose a website records all information related to visits including gender, device, time, etc. When a new impression happens we store it and we want to predict when this person will re-visit the website. For example, suppose 10 people have visited our website and we want to predict the time that one of these 10 people will revisit our website again (the first person among these 10 people). This problem can be modeled as a regression but the challenge is that as time goes on, the number of people increases and I am wondering how to convert all information to features in a regression model. What approach do you recommend to model it? Is it possible to model it with conventional models like OLS?

An example of data can be as follows

Records  ID  gender   device  time_of_first_visit  purchase($)      time_of_second_visit
1        1   male     phone   1:25 PM              235              1:55 PM
2        2   male     tablet  1:47 PM              200              2:15 PM
3        3   female   PC-Win  2:15 PM              140  
4        4   male     Mac     2:37 PM              350
5        5   female   phone   2:43 PM              450

Now, suppose that it is 3:00 PM. Now, we how the first two customers behaved and we can use them as our training data. Our goal is to predict which of these 3 people (3, 4, and 5) will re-visit our website first and at what time. If we want to do the same at the time 3:15 PM, it is possible that a new person visits our website and the total number of records for prediction purposes will be 4.

The challenge is that because arrivals are random, at each time, a different number of people can potentially revisit the website. My model should answer who and when will revisit the website again because I need to know how much they have bought before.

  • $\begingroup$ There are a few issues with the way the problem is designed: first, how is the group of visitors defined? If there is a specific group of target people, then an instance should probably contain information about the whole group. Second, this can be a regression problem only if you have some data where the target variable is known. This is usually done by using past records and using instances where the same person visits the site again. Try to figure out a way to represent what is an instance and apply it to some past data, that will help formalize the problem better. $\endgroup$
    – Erwan
    Sep 25, 2021 at 14:56
  • $\begingroup$ Thanks Erwan. You are right and we need to have some samples with targert. In my example, at time 3:00 Pm, it is possible that the first person re-visit the website again at 2:35 PM and it is one of our samples. Suppose we have enough historical data, but in real-time cases, I don't know how to use all information in a regression model. It is possible that right now, there are 20 people which may revisit the website. But one hour later, there might be 24 people who may revisit the website. I am wondering how to predict who will revisit the website at first and when. $\endgroup$
    – Aaron
    Sep 27, 2021 at 2:40
  • $\begingroup$ If there is no or little information specific to the users, the only option in real time is to model how long it takes on average for a user to visit again. This value might depend on the time of the day or day of the week for example, so these could be the features and the target is the average duration before the next visit. $\endgroup$
    – Erwan
    Sep 27, 2021 at 12:28
  • $\begingroup$ Thanks, Erwan. I edited the question and I would be thankful if you can guide me. $\endgroup$
    – Aaron
    Sep 28, 2021 at 2:39
  • $\begingroup$ It's not clear to me if you have a way to identify visitors? Is the id a user id, i.e. the same user would appear with the same id at different times? If not, I don't see how you could determine which user comes back first. $\endgroup$
    – Erwan
    Sep 29, 2021 at 21:43

1 Answer 1


That problem would be better modeled as survival analysis, the expected duration of time until one event occurs. The event in your case would be revisit to the website. Survival analysis could also predict which people are most likely to revisit.

  • $\begingroup$ Exactly, it is a survival model but my problem is how to use a regression model when the number of people visiting the website varies over time and there is not a fixed size to represent potential people who might revisit the website. $\endgroup$
    – Aaron
    Sep 28, 2021 at 15:50

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.