Multiclass Classification on live sensor data I want to use an accelerometer to detect which way a train is heading.
You could do this by just setting thresholds manually to detect the direction of acceleration on the x-axis (which would be aligned to the trains driving axis) after a standstill. 

I still want to solve this problem using machine learning, because setting the thresholds takes quite some time.
The sensor data has to be in a context, otherwise its useless. The driving direction can only be estimated if you know the n sensor readings before.

So now I could probably use a RNN to create this context.
My ideas was it to not use a RNN (since it adds complexity) and just put several measurments in one sample. It would look like this:
accelX,accelY,accelZ,accelX1,accelY2,AccelZ2....AccelXn,AccelYn,AccelZn, label

I also measure the Y- and Z-axis because they are important to tell if you are standing still or just driving very smoothly without much acceleration (you have peaks in the Z-axis because you drive over bumps and in curves you have peaks on the Y-axis)

These samples would be taken one after another. This would create the context the net needs to judge it the sample was either standstill,accelerating positive on the X-Axis, accelerating negative on the X-Axis or if the train is just driving normally. 

After my net would be trained I could just measure, pack and feed these samples in my net and in the end get a classification. If now one sample is classified as standstill and the next following one as accelerating+, I'd now that we are now driving forward. If a driving then standstill then accelerating- follows I then know, that we are now driving backward. 

My dataset will be quite unbalanced since the train is mostly driving and only accelerating once after every station. In addition, my dataset won't be too big since I can only record data when I'm in the train.

I would like to use keras for building my model since its easy to understand.

Now my questions:


Do you think my approach will work?
What model architecture do you suggest me?
Should I manually classify my samples or use unsupervised learning?
Should I also include other features (variance of the data ..)


Thanks for the help
I would suggest you use a simpler method first, just to have a baseline to compare from.

In your case you can adapt this jupyter notebook to fit your purpose. They train a k-NN model to compare time-series using similarity measures.

After you're comfortable with that, you can move on to using LSTMs for classification


LSTMs for Human Activity Recognition
Multilabel time series classification with LSTM


The last one also works if you are trying to predict multiple labels per sample.