# How to input data to LSTM?

I have a labelled dataset (0 and 1) with two types of short length time series data (from day1-day5) as follows.

Type1 (Temperature at location1):

sensor1, 38, 38, 35, 33, 32
sensor2, 33, 32, 35, 36, 32
and so on ....


Type2 (Temperature at location2):

sensor1, 18, 18, 12, 11, 09
sensor2, 13, 12, 15, 16, 12
and so on ....


In summary my dataset looks as follows.

ID, time-series1, time-series2, label
sensor1, [38, 38, 35, 33, 32], [18, 18, 12, 11, 09], 0
sensor2, [33, 32, 35, 36, 32], [13, 12, 15, 16, 12], 1
and so on ....


I would like to use my dataset in LSTM (or a equivalent deep learning model).

However, I am still not clear how I can use my dataset in a deep learning model such as LSTM.

I am happy to provide more details if needed.

• Are you sure you want an autoencoder if you have labels? Do you not want to predict the label? – timchap Jul 16 '19 at 9:03
• @timchap Thank you for the comment. My knowledge about deep learning is very low. I thought autoencoder would work. if it is not suitable for my problem, I am happy to recieve and accept answers in other deep learning models that suits my problem. Please let me know your thoughts :) – EmJ Jul 16 '19 at 10:25
• The goal of an autoencoder is to learn how to "compress" (encode) some data to some latent representation and subsequently reproduce the original data (decode) from that compressed form. An LSTM autoencoder applies this technique to sequence data. You probably want an "LSTM classifier" (try searching this term instead), whose goal typically is: given a sequence, predict the target value. I think that is closer to what you what you are looking for. – timchap Jul 16 '19 at 10:48
• @timchap thank you. I have edited the question accordingly. I will search in google too. thank you :) – EmJ Jul 16 '19 at 11:42

Keep the number of observations to None when you define the LSTM input_shape. The number of input series in this case is 2, since you are using two time series to make predictions. Window size is the length of your time series row. Your input shape would then be:
input_shape = (2, window_size)