Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- yhat = model.predict(test_X)
- test_Xt = test_X.reshape((test_X.shape[0], test_X.shape[2]))
- # invert scaling for forecast
- inv_yhat = np.concatenate((yhat, test_Xt[:, 1:]), axis=1)
- inv_yhat = scaler.inverse_transform(inv_yhat)
- inv_yhat = inv_yhat[:,0]
- # invert scaling for actual
- test_yt = test_y.reshape((len(test_y), 1))
- inv_y = np.concatenate((test_yt, test_Xt[:, 1:]), axis=1)
- inv_y = scaler.inverse_transform(inv_y)
- inv_y = inv_y[:,0]
- # calculate RMSE
- rmse = np.sqrt(mean_squared_error(inv_y, inv_yhat))
- print('Test RMSE: %.3f' % rmse)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement