Python Forum
arima model error in python
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  LDA Model prepare() method failure in Python noerkes 0 239 Feb-22-2024, 01:42 PM
Last Post: noerkes
  How to run a linear model by group in Python? Betty775522 0 515 Oct-18-2023, 07:09 PM
Last Post: Betty775522
  Demand Forecasting using Arima LukasBen123 6 1,176 Jul-21-2023, 11:58 PM
Last Post: Pedroski55
  Using SHAP Library for my LSTM model - "Attribute Error" vatsalmtailor 0 2,040 Jul-13-2022, 04:34 PM
Last Post: vatsalmtailor
  issue displaying summary of whole keras CNN model on TensorFlow with python Afrodizzyjack 0 1,619 Oct-27-2021, 04:07 PM
Last Post: Afrodizzyjack
  Parallelizing Run ARIMA Model wissam1974 0 2,927 Mar-02-2019, 07:20 PM
Last Post: wissam1974
  ARIMA.Fit memoryError wissam1974 2 4,059 Feb-23-2019, 07:21 PM
Last Post: wissam1974
  ARIMA error with hight MA order wissam1974 0 4,249 Feb-16-2019, 02:57 PM
Last Post: wissam1974
  How to use a pmml model in Python FlamingGuava 3 13,323 Aug-05-2017, 05:15 PM
Last Post: radioactive9

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020