Tensorflow Time series forecasting example: how can i scale back the predicted data?

Viewed 142

I am going through this introduction to the time series forecasting using RNNs and I am adapting the code to a different dataset.

As the data gets normalized using:

uni_train_mean = uni_data[:TRAIN_SPLIT].mean()
uni_train_std = uni_data[:TRAIN_SPLIT].std()
uni_data = (uni_data-uni_train_mean)/uni_train_std

I assumed that the predicted value should be scaled back, but I am trying to figure out how to do it with no success. Any help would be much appreciated here. Thank you very much.

1 Answers

This is the process to scale back your prediction

y_pred = model.predict(X_test)
y_pred = (y_pred*uni_train_std) + uni_train_mean

this is simply the inverse operation of scaling

Related