sia
sia

Reputation: 613

How to build an irregular time-series prediction model in python?

I'm trying to build a model, data consists of specific date_time for every day (the action can happen multiple times every day) and I want to predict the next time the action will happen.

Sample data looks like this:

2021-12-17 21:28:26
2021-12-17 22:17:37
2021-12-17 22:27:21
2021-12-17 23:33:25
2021-12-17 23:57:27
.
.
.
2021-12-23 11:12:27
2021-12-23 12:01:11
2021-12-23 13:19:44
.
.
.

predict next action time???

I tried to model my data with prophet but I'm not sure that is the best option for me. I'll be happy if anyone can help and introduce me to libraries/packages. Or give me some keywords to search about that.

P.S. I'm not very familiar with this topic and started a few days ago to search about that.

Upvotes: 3

Views: 1126

Answers (1)

César Correa
César Correa

Reputation: 188

I see two possible ways to improve the predictions, a fast and a more complex one.

1.- For the fast way what I would do is modify the data to fill up the gaps of seconds between each activation (assuming each activation occurs with more than a second of difference between the next one).

date,                 activated 
2021-12-17 22:17:00,  1
2021-12-17 22:18:00,  0
2021-12-17 22:19:00,  0
2021-12-17 22:20:00,  0
2021-12-17 22:21:00,  0
2021-12-17 22:22:00,  0
2021-12-17 22:23:00,  0
2021-12-17 22:24:00,  0
2021-12-17 22:25:00,  0
2021-12-17 22:26:00,  0
2021-12-17 22:27:00,  1
.
.
.
2021-12-17 23:33:00,  1
.
.
.

then you can use a simple but very powerful model, an XGBoost regressor to try to predict the next time an activation would occur.

2.- A second way would be complementing the first one, which involves Feature Engineering trying to come up with features from the data like Mean & standard deviation of the differents activations.

then you could use an Xgboost just like the first case or some other Neural Network classifier or RNN.

You could try some ideas from this post which also explain pretty well how to do each part of the process including the feature engineering: https://towardsdatascience.com/predicting-next-purchase-day-15fae5548027

Upvotes: 2

Related Questions