Python Forum
numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.linalg.LinAlgError: SVD did not converge When making ARIMA forecast
#1
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)
Larz60+ write Feb-15-2021, 11:18 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.

Fixed for you this time, please use bbcode tags on future posts.
Reply
#2
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to install pyramid.arima in jupyter notebook bntayfur 1 4,163 Aug-06-2020, 04:37 AM
Last Post: ndc85430
  ImportError:DLL Load Failed after importing scipy.sparse.linalg sea_jam 0 2,349 Jul-31-2020, 01:54 AM
Last Post: sea_jam
  Vintage analysis balance forecast HELP! Phoenixmaniac 0 2,375 Sep-10-2018, 03:45 PM
Last Post: Phoenixmaniac

Forum Jump:

User Panel Messages

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