Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. yhat = model.predict(test_X)
  2. test_Xt = test_X.reshape((test_X.shape[0], test_X.shape[2]))
  3. # invert scaling for forecast
  4. inv_yhat = np.concatenate((yhat, test_Xt[:, 1:]), axis=1)
  5. inv_yhat = scaler.inverse_transform(inv_yhat)
  6. inv_yhat = inv_yhat[:,0]
  7. # invert scaling for actual
  8. test_yt = test_y.reshape((len(test_y), 1))
  9. inv_y = np.concatenate((test_yt, test_Xt[:, 1:]), axis=1)
  10. inv_y = scaler.inverse_transform(inv_y)
  11. inv_y = inv_y[:,0]
  12. # calculate RMSE
  13. rmse = np.sqrt(mean_squared_error(inv_y, inv_yhat))
  14. print('Test RMSE: %.3f' % rmse)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement