Using this tutorial, which deals only with multivariate and one step, I have been trying to write a multivariate and multistep code. Since the code is too long I'm attaching it here (you'll find the dataset as well in the same repository as well).
The aim of the code is to predict the Pollution values of the next 6 hours.
After preprocessing the data and normalizing it, I have split the data and reshaped it as follows:
# split into train and test sets
values = reframed.values
n_train_hours = 365 * 24 * 1 # 5 years data 1 year training
train = values[:n_train_hours, :]
test = values[n_train_hours:n_train_hours+50, :]
# split into input and outputs
n_obs = n_hours * n_features
train_X, train_y = train[:, :n_obs], train[:, :n_out] # the problem is here
test_X, test_y = test[:, :n_obs], test[:,:n_out] # and here
# reshape input to be 3D [samples, timesteps, features]
train_X = train_X.reshape((train_X.shape[0], n_hours, n_features))
train_y = train_y
test_X = test_X.reshape((test_X.shape[0], n_hours, n_features))
print(train_X.shape, train_y.shape, test_X.shape, test_y.shape)
I have a problem with the train_X, train_y, test_X, and test_y, I'm not sure if I have to use n_out and n_obs instead of n_out*n_features and n_obs or another alternative since in both cases by using inverse_transform on inv_y, I get values that are different to the real ones on the dataset:
print('predicted: ',inv_yhat)
print('real:' ,inv_y)
predicted: [ 3.04286 7.406884 6.121824 ... -10.307352 -7.0151763
-3.4667058]
real: [36. 30.999998 19.999998 ... 24.999998 48. 48.999996]
Please let me know if you need more details.
