# Predicting or patron find of a binary variable over time

I'm new to ML and trying to find some practical use to it I encountered with the chance of saving the connections and disconnections (the binary variable) of a bunch of users like this:

"User A connected at 10:02:33

User A discconected at 10:05:02"

I was wondering how could I determine whenever the user is going to connect again, analyzing his pasts connections, disconnections and time online.

My concers are the following:

• Would this be posible?
• What's the best method for this?
• How much samples per user would I need?
• What would be the best way to structure the data, and besides the user identifier, action(connect/disconnect) and time the action take place what other info would be useful?

An just as an extra question: Would it be possible to add more data in real-time to improve the algorithm prediction? How?

$\hat y(x) = \dfrac{1}{1+\exp(-\left< w, x \right>)}$ and $y=\begin{cases}1, \text{user present} \\ 0, \text{user absent} \end{cases}$.
For details read the wikipedia article. For features, I would use the time of day encoded as $\left( \sin (2\pi t/T), \cos (2\pi t/T) \right)$, a hot-encoded categorical variable for the day of the week, a binary variable to indicate weekends, and so on. It's a crude model that leaves a lot of data on table, such as correlations between users, but as a beginner's exercise it is appropriate.