0

我无法获得准确的测试预测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)
4

0 回答 0