Python Forum
numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast (/thread-32525.html)



numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast - jnans12 - Feb-15-2021

Why do I get numpy.linalg.LinAlgError: SVD did not converge error when I set my ARIMA model to ARIMA(3, 1, 3)? With other parameters it seems to work fine. When I try to put it into try and except block I get ValueError: Found input variables with inconsistent numbers of samples: [76, 29]. What could be the issue?

def ARIMA_forecast(series):
    X = series.values
    size = int(len(X) * 0.7)
    train, test = X[0:size], X[size:len(X)]
    history = [x for x in train]
    predictions = list()
    for t in range(len(test)):
        model = ARIMA(history, order=(3, 1, 3))
        model_fit = model.fit(disp=0)
        output = model_fit.forecast()
        yhat = output[0]
        predictions.append(yhat)
        obs = test[t]
        history.append(obs)
        print('predicted=%f, expected=%f' % (yhat, obs))
    # evaluate forecasts
    rmse = sqrt(mean_squared_error(test, predictions))
    print('Test RMSE: %.3f' % rmse)
    # plot forecasts against actual outcomes
    plt.plot(series, label='Training data')
    plt.plot(series[size:len(X)].index, predictions, color='blue', label='Predicted Price')
    plt.plot(series[size:len(X)].index, test, color='red', label='Actual Price')
    plt.legend()
    plt.show()
df = pd.read_csv('FB.csv', header=0, index_col=0, parse_dates=True)
series = df['Adj Close']
ARIMA_forecast(series)



RE: numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast - nilamo - Feb-15-2021

What are some examples of parameters that don't fail?

I don't know anything about arima, but from the error message, I'm guessing some part of the dataset only has 2 values instead of 3? But again, I don't know what the order argument of arima is expecting or used for. What package is this from, so we can look at the docs?