# LSTM - How to prepare train from a dataset which contains multiple observations for different events

I m using LSTM in a project related to MobiFall dataset which contains falls and daily activitives - such as walking, sitting etc - sensed by accelerometer, gyroscope and orientation sensors in x,y,z axes.

So I need to modify LSTM into multi-variate form. How could it be done?

And after this problem is solved, I have to deal with another, there are multiple time-series events in different files which were done by different people. For example, I have got ADL_1_walking_1_.txt, ADL_1_walking_2.txt, ADL_2_jumping_3.txt (Naming convention of text files is ActivityType_SubjectNo_ActivityName_SampleNo.txt) which contains acc-x, acc-y,acc-z, gyro-x, gyro-y, gyro-z, ori-x, ori-y, ori-z data where acc means accelerometer, gyro means gyroscope and ori means orientation.

So how should I train my model? Should I combine all of those files? But doing this will cause model to suppose they are all from the same observation right? So it may lead wrong calculations. Should prepare a training and test test for each file and train the model over and over again? So my question is what are the general solutions for this kind of problem. Can you tell me some of these solutions?

## 1 Answer

It's just several time-series with same data. You should make preprocessing (if it's neccessary) and can provide as an input just for one RNN layes. for example

model.add(GRU(units=512,return_sequence=True,input_shape=(None,number_of_inputs))

• Why is the first parameter of input_shape is None instead of input_shape=(window_size, number_of_features) – Khan9797 Nov 3 '18 at 18:19
• because this is the first layer in the model, Keras needs to know the shape of its input, which is a batch of sequences of arbitrary length (indicated by None)where each observation has a number of input-signals (number_of_inputs). – Vladimircape Nov 5 '18 at 12:23