I have been trying to understand how to build LSTM model for multivariate time series forecast using Keras but I am still unsure how to present the data in the correct shape.

My Dataset:
•   5 cities.
•   Each with 2 features. Temperature and humidity.
•   Daily records of the last 10 weeks(Monday, Tuesday, …, Sunday)

What I want to do:

Given Monday’s record of the new week of a city, I'd like to forecast the Temperature and humidity for the remaining 6 days of that city. I.e. Multi-Step Forecast for Multivariate Time Series. Output shape(6,2)

How I have started off:

For each city, the input shape [(num_samples, num_time_steps, num_features) ] would be (10, 7, 2).

For 10 weeks, I will have five unique samples(5-cities) with the same shape (70, 2). So if I stack all vertically I will have (350, 2) or 3D shape (50,7,2). Then create a supervised series with lag 1, I will have a shape(244, 4)

# Split train/test data. 
train on 7-weeks. So input_shape= 5*(7,7,2) = (35,7,2)
test on 3-weeks. . So input_shape= 5*(3,7,2) = (15,7, 2)

What I am confused about:

The above layout seems to disregard the unique nature of each sample. I looked at this but still, a bit confused on how to transform it to a regression model.

I want the network to train each city's data separately as in this pic I would appreciate any suggestion. Thanks


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.