Friday, 28 August 2020

why the model is doing prediction for first 5 days of the given month only

I attempted to do a prediction with an ARIMA model (with python). P, D, Q, p,d,q values determined through ADF test, plot_acf, plot_pacf and can be shared if required.

Code is mentioned below.

import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
import statsmodels.api as sm


df = pd.read_csv(r'https://github.com/sreerajva5/ML/raw/master/sample_data_ts.csv')
df['Date'] = pd.to_datetime(df['Date'])
df.set_index('Date', inplace=True)
model = sm.tsa.statespace.SARIMAX(df['sample_data'], order=(0,1,0), seasonal_order=(1,1,12,30))
result = model.fit()


future_dt = pd.Series(pd.date_range('2012-06-01', periods=60, freq='D'))
future_dt_df = pd.DataFrame(index=future_dt, columns=df.columns)
future_df = pd.concat([df, future_dt_df])
future_df['forecast'] = result.predict()

I created the model and attempted to predict next 60 days (2 months) numbers. But first five days of first month and first 5 days of second month values are getting predicted. In between values are not getting predicted.

Result received is given below.

"
2012-06-01  453.815056
2012-06-02  298.5604767
2012-06-03  270.5269854
2012-06-04  203.402702
2012-06-05  123.2703868

No values from predicted (its blank) against dates from 2012-06-06 to 2012-06-30
    
2012-07-01  475.5137062
2012-07-02  257.9273124
2012-07-03  272.8564157
2012-07-04  218.3305799
2012-07-05  123.9411595


Again no values from predicted (its blank) against dates from 2012-07-06 to 2012-07-30
"

What is the reason for this, and how can I get a proper prediction?



from why the model is doing prediction for first 5 days of the given month only

No comments:

Post a Comment