# Machine learning to estimate p(y>N | X) where N is a duration

To illustrate, let's say I have a mobile game and I want to predict the duration of each session $$y$$ when they start.

Say I have a training set with multiple useful features $$X$$ from previous sessions and their corresponding $$y$$. If I want to use those features to directly predict future sessions duration, I have a regression problem.

How can I, however, predict the probability that a session will take longer than $$N$$, for any value of $$N$$?

• You can use an ordered logistic regression or decision trees. Check this and this for examples. Commented Mar 13, 2019 at 14:08
• I think your examples are multiclass and ordinal classification, in which cases we have discrete targets. In my case I have a continuous target and I wan't to be able to calculate a probability given a continuous threshold value $N$.
– jcp
Commented Mar 13, 2019 at 14:22

You want to estimate the probability $$P(y>Y|X)$$ where $$Y$$ is a survival time variable, and $$y$$ is a particular time value (that you called $$N$$).This problem can be approached from two angles.
First of all you could define a new variable $$Z=1$$ if $$y>Y$$ and else $$Z=0$$. The classification problem $$P(Z=1|X)$$ then can be solved by machine learning or other regression models, such as logistic regression or SVM or any other technique you like.
This approach presupposes that none of the cases in your data are censored. This means that for all cases it has been recorded when their session stops. Otherwise you have missing values in $$Z$$, and this problem is more complex to address.
An alternative strategy that also works if you have censored data, is to not predict $$P(Z=1|X)$$ and instead focus on $$P(y>Y|X)$$ using survival models. A simple model is the Cox proportional Hazard model, which however is not exactly a machine learning model, and makes some assumptions regarding linearity and so called proportional hazards. However there are also survival models using for example random forests or regression trees which are more flexible. These models give you the probability of survival beyond any time point $$y$$ you choose, and often have a built in way to deal with censoring.
• Thanks! I will take at survival models. The first advice is unfortunately not applicable to my case because it requires a fixed $Y$, but in my case I would like to be able to choose a different $Y$ for each new session.