I have one business problem in hand which is to predict if a user will revisit the website or not within 6 months. I need to majorly understand what are the factors which make the user return and also need to give business recommendations on what can be done to make a new user return to the website. My initial idea was to do logistic regression. Lately, I read about survival analysis. I want to know if I can use survival analysis for this problem. Also, my dataset has 20k users; each user having multiple transactions; the target variable was not given I aggregated the dataset to one record per user and did some feature engineering to come up with a target variable. If I want to use survival analysis in this problem, shall I consider only the last transaction of each user or shall I use the aggregated dataset?

  • $\begingroup$ I'm not expert in survival analysis but I thought it was useful only for studying a population over time, so if I'm right that doesn't seem a good fit for predicting whether a particular user will revisit. I might be wrong though. $\endgroup$
    – Erwan
    Commented Nov 3, 2019 at 23:44

1 Answer 1


If you want to use survival analysis (which can be more flexible and insightful), I'd recommend this package and this great tutorial. Speaking shortly, as a result, you'll get "probability of being alive" for each customer.

If you want to use logistic regression I think it's trickier. Why I think so - Like any other churn problem, it's hard to define it properly. The definition depends on your task and where the model outcome will be used. Let's say churn is a particular amount of inactivity, e.g. 30 days. You can do an initial analysis of how to find this number. Just pick a particular date (you can do it multiple times) and check % of people who made next transaction. Important thing is - your time period from both sides should be same for all users:

  • if it's a new users he's not able to be inactive for a long period, right?
  • if it's a last date in the dataset (e.g. yesterday) - not all users are not able to perform transaction within 1 day. And you'll get high churn rates. So be attentive to dates.

So you need to understand from your data - which inactivity is "normal" for the average user and define it as N. After that you can label users binary like "if inactivity > N then "churned (1)" else "not churned (0)"". And you can use this label with any classification model.


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.