I want a direction for ML technique to predict the next time you will be online in chat app

My table contains; user id, timestamp & status

status is a categorical variable (online, composing, offline), I'm saving a row for each status change which means user online, maybe writes something to me (composing) and afterwards went offline, so I can extract the time online (currently I don't see a reason for this feature)

  • I want to export the model to PMML

What is the best approach if I want to a service to get the next timestamp that user will be online ?

  • 2
    $\begingroup$ Whoever keeps downvoting posts but not commenting, stoooooooop! Please post a reason for the downvote. $\endgroup$
    – Hobbes
    Apr 13, 2017 at 15:07

3 Answers 3


That sounds like time series forecasting. Here's a related post:



If you are able to use python at all, I'd look into using a recurrent neural network variant such as LSTM or GRU to forecast their future timestamps.

Chris Olah wrote a really nice blog post on LSTM / Recurrent nets http://colah.github.io/posts/2015-08-Understanding-LSTMs/

Using the python library Keras, it is actually very easy to code an LSTM network. The general "Sequential" model (most straighforward / basic model type) is described here: https://keras.io/getting-started/sequential-model-guide/ Your model could be made through the sequential model type, using recurrent layers instead of Dense ones. The only thing is your inputs need to be shaped correctly, so you'll be dealing with a 3D tensor (3d numpy array) for the time series input, where [N,T,K] is the shape of the tensor: N= # of samples, T = # of timesteps in the input and K = # of variables. You will probably have to zero pad / mask the timesteps for uneven sequences as well, which is fairly easy to do.

Recurrent / LSTM / GRU layers in Keras are described on this page: https://keras.io/layers/recurrent/

Best of luck!

If this is too much then I guess you can just work with time series models. But reccurrent nets have been known to perform incredibly with an array of temporal problems / prediction.


I agree with the two answers above me!

This is a time series forecasting problem.

Python with tensorflow and keras would be the best route to build the model and have it able to be exported to train somewhere else.

Start off with something nice and simple, if it doesn't do what you want add some more layers, tinker with the learning rate, etc.

Here is a link very similar to what you want to do: Tutorial

Hope that helped! Enjoy building it, this stuff is a lot of fun!!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.