Shahid Khan
Shahid Khan

Reputation: 303

Inverse Standardization of predicted values

I've dataset with two columns. At first I've split the data into train, val and test and after that I've standardized all the data (train, val and test).

train_mean = train_data.mean()
train_std = train_data.std()

train_df = (train_data - train_mean) / train_std
val_df = (val_data - train_mean) / train_std
test_df = (test_data - train_mean) / train_std

After that I've split the train_df and val_df into X_train, X_test and y_train, y_test respectively for model training.

time_step = 288 
X_train, y_train = create_dataset(train_df, time_step)
X_val, y_val = create_dataset(val_df, time_step)

After and training the model I've predict the values but when I tried to inverse the predicted values it gives me error.

test_predict=multi_step_dense.predict(X_val)

Inverse the predicted values:

inverse_data = (df * data_std) + data_mean

The error which I'm facing

ValueError: Length of values (14604) does not match length of index (2)

Upvotes: 0

Views: 183

Answers (1)

rezan21
rezan21

Reputation: 1155

difficult to follow without the possibility of replicating the issue. however, shouldn't it be (test_predict * data_std) + data_mean

Upvotes: 0

Related Questions