预测值不准确

时间:2017-12-13 09:06:38

标签: python scikit-learn time-series arima

我无法在print()获得准确的测试预测。有关使用Test.csv进行预测的正确方法的任何帮助将不胜感激。

from sklearn.metrics import mean_squared_error

x = df_log.values
y = df_test.values

train,test = x,y
flag = [i for i in train]
prediction = list()

for j in range(len(test)):
    model = ARMA(flag, order = (1,9))
    model_fit = model.fit()
    out = model_fit.forecast()
    y_hat = out[0]
    prediction.append(float(y_hat))
    observation_val = test[j]
    flag.append(observation_val)
    print('predicted_val =%f' % np.exp(y_hat), 'expected_val =%f' % observation_val)

err = mean_squared_error(test,prediction)

0 个答案:

没有答案