RJT1990 / pyflux

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

Bug in Predict function-unable to generate out sample prediction #128

Open ghost opened 6 years ago

ghost commented 6 years ago

I am trying to implement out of sample prediction using predict function of Pyflux package. But to my surprise instead of giving out of sample prediction, it returns in sample predicted values.Sample code below:

import pandas
import numpy as np
import datetime
import pyflux as pf

print('Version of Pyflux is %s'%(pf.__version__)) ## output= 0.4.15
minTime=datetime.datetime(2016,1,1)
maxTime=datetime.datetime(2016,6,1)
datetime_range=pandas.date_range(minTime, maxTime, freq='%dmin'%(30)) 

data=pandas.DataFrame(np.random.rand(datetime_range.shape[0],1),columns=list('A'))  
data.index=datetime_range

model_py = pf.ARIMA(data=data, ar=1, ma=1, target='A', family=pf.Normal())
model_fit=model_py.fit('MLE')

model_py.predict(12,intervals=False)

If we check last 10 values of data DataFrame we get-

enter image description here

As per Pyflux package documentation, predict(h) should give how many step forecast ahead but model_py.predict(12,intervals=False) gives last 12 in-sample prediction of data DataFrame

enter image description here

This looks strange!!!

aalto1 commented 5 years ago

I have the same problem

zhongjie526 commented 4 years ago

same problem here, very embarrassing bug.