Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 arima model error in python
#1
hi
i am using the software PyCharm(2018.1) software to create ARIMA model in pyhthon
here is the model that i have created:

def arima_Model_Static_PlotErrorAC_PAC(series, arima_order): 
    # prepare training dataset                               
    X = series  # print(X)    exit()
    train_size = int(len(X) * 0.50)  # 0.50
    train, test = X[0:train_size], X[train_size:]
    history = [x for x in train]     # make predictions    print(len(history))     print(history)     exit()
    errorList=list()
    expected= list()
    predictions = list()
    obs = list()
   
    for t in range(len(test)):
        model = ARIMA(history, order=arima_order) #exit()
        model_fit = model.fit(disp=False, transparams=False)
        yhat = model_fit.forecast()[0] #model_fit.forecast()[0] exit()
        predictions.append(yhat)
        obs = test[t]   
        history.append(obs) 
        expected.append(obs)
        errorResidualExpePred = obs - yhat 
        errorList.append(errorResidualExpePred)
        print('epoch=%i, predicted=%f, expected=%f' % (t, yhat, obs))

    mse = mean_squared_error(test, predictions)
    rmse = sqrt(mse)   
    print(model_fit.summary())
    print(rmse)
    return errorList
i called this model as follow:
series=np.array(diffARIMA)
#series=colDataSet
arima_order=(11,0,32)
outputResidualError=arima_Model_Static_PlotErrorAC_PAC(series, arima_order)
also the values of p, d, q are well chosen by applying the following rules
  • remove the seasonality
    • p: lag value where PACF cuts off first, so p=11.
    • d=0 because apply the ADF test test and found my series is stationary so no differentiate has been done
    • q: lag value where ACF chart crosses the upper confidence interval first, so q=32
.

the error that i have got when i run the model:
Error:
File "C:/109_personel/112_pyCharmArima/Presentation.py", line 296, in arima_Model_Static_PlotErrorAC_PAC model_fit = model.fit(disp=False, transparams=False) File "C:\109_personel\112_pyCharmArima\venv\lib\site-packages\statsmodels\tsa\arima_model.py", line 946, in fit start_ar_lags) File "C:\109_personel\112_pyCharmArima\venv\lib\site-packages\statsmodels\tsa\arima_model.py", line 562, in _fit_start_params start_params = self._fit_start_params_hr(order, start_ar_lags) File "C:\109_personel\112_pyCharmArima\venv\lib\site-packages\statsmodels\tsa\arima_model.py", line 541, in _fit_start_params_hr raise ValueError("The computed initial AR coefficients are not " ValueError: The computed initial AR coefficients are not stationary You should induce stationarity, choose a different model order, or you can pass your own start_params.
Finally i would like to mention that if a apply my model by selecting the following arima order
arima_order=(11,0,0)
arima_order=(0,0,16)
my modele is well executed

any help will be appreciated

Thank you
Larz60+ wrote Jan-23-2019, 12:51 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

I fixed for you this time. Please use code tags going forward. Thank You.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Parallelizing Run ARIMA Model wissam1974 0 329 Mar-02-2019, 07:20 PM
Last Post: wissam1974
  ARIMA.Fit memoryError wissam1974 2 515 Feb-23-2019, 07:21 PM
Last Post: wissam1974
  ARIMA error with hight MA order wissam1974 0 588 Feb-16-2019, 02:57 PM
Last Post: wissam1974
  How to use a pmml model in Python FlamingGuava 3 7,712 Aug-05-2017, 05:15 PM
Last Post: radioactive9

Forum Jump:


Users browsing this thread: 1 Guest(s)