RJT1990 / pyflux

Open source time series library for Python
BSD 3-Clause "New" or "Revised" License
2.11k stars 240 forks source link

Prediction - indices for forward predictions with half-hourly data #70

Open Nicolas99-9 opened 7 years ago

Nicolas99-9 commented 7 years ago

I found a bug with ARIMA prediction. I have trained the model. The last lines of my data : 2012-12-27 03:00:00 0 2012-12-27 03:30:00 0 2012-12-27 04:00:00 0 2012-12-27 04:30:00 0 2012-12-27 05:00:00 0 2012-12-27 05:30:00 0 2012-12-27 06:00:00 0 2012-12-27 06:30:00 0 2012-12-27 07:00:00 0 2012-12-27 07:30:00 0 2012-12-27 23:00:00 0 2012-12-27 23:30:00 0

Model training : model = pf.ARIMA(data=sub_data,ar=4,ma=4,integ=0,target='passengers') x = model.fit("MLE")

When I try to predict :
tmp_prediction = model.predict(7)

It returns the 7 last data (from the paste). There is a problem with the predictions. I would like to predict the future not the past !

2012-12-27 05:30:00 0.006293 2012-12-27 06:00:00 0.008389 2012-12-27 06:30:00 0.008493 2012-12-27 07:00:00 0.008549 2012-12-27 07:30:00 0.008560 2012-12-27 23:00:00 0.008603 2012-12-27 23:30:00 0.008612

How to solve that ?

RJT1990 commented 7 years ago

This is more likely to be an issue with the indexing rather than the values. What has likely happened is that the index has not rolled forward. Will look into it.

Nicolas99-9 commented 7 years ago

So it's a problem with the index but the values are really predicted ahead ?

RJT1990 commented 7 years ago

I can't confirm that right now but that is my strong suspicion.

Nicolas99-9 commented 7 years ago

I don't know if it could help you but the the start date of my ARIMA model (summary function) is different from the first date of the index.

Please let me know if you correct the bug.

RJT1990 commented 7 years ago

Have renamed this issue to reflect the problem. I think you can probability infer what the indices should be for the forward predictions in the meantime? Just add a datetime.timedelta() to correct.