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.
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.