# How can you build a model based on non-independent imbalance data?

I am trying to predict customer churn based on the data that I have. I am defining churn as an activity that is not followed by another activity within a week. The customer might come back in two months and become active again and those activities are not considered churn.

Therefore, the same user might be considered churned or not churned depending on future behavior. Also, only 0.5% of these observations result in churn.

Now for this data set, I have both dependant and imbalance data. How can I perform modeling, or even simple t-test (as its assumption is independence)? Any idea or direction is highly appreciated.

So in essence (if I understand correctly), you want to predict a customer "not being active" within a week versus "being active"?! So you have a binary problem. The choice of method depends on your data. But a good start might be, for instance, catboost, a gradient boosting tool. I have good experiance with it.

https://catboost.ai/docs/concepts/python-usages-examples.html

With the CB classifier, you can specify class_weights, which might help to cope with unbalanced classes.

https://catboost.ai/docs/concepts/python-reference_catboostclassifier.html#python-reference_catboostclassifier

Here is a Python tutorial: https://github.com/catboost/tutorials/blob/master/python_tutorial.ipynb

Regarding the "non-independent" aspect: Do you mean that the SAME customer can fall in both classes at different points in time? Maybe this is not too much of a problem as long as something changes in the X variables (the ones used for prediction). Time certainly changes, right? So you might include time, e.g. as a factor (or dummy) variable. Often this works well with gradient boosting. Maybe (just an idea) you could also add a customer ID in addition to time, in order to try to control for each individual customer or (similar) groups of customers.

Alternative methods/tools would be lightgbm, logistic regression (with regulation), or even neuronal networks (e.g. Keras/tensorflow based). Time can also be included as count or dummy in logistic regression. In neuronal networks, dealing with time often is a bit complicated. To say more about it, one ultimately need to see the data in detail (number of X variables/columns, number of observations etc).