Improving our solution
There are several directions in which we can proceed to improve our algorithm for motion recognition.
Probabilistic interpretation
The CMMotionActivity
class provides a confidence level for each predicted motion type. We can also add this feature to our algorithm. Instead of returning one label, we can return the proportion of labels among neighbors.
More data sources
We've used only accelerometer, but we could use gyroscope and magnetometer also. This can be done in several ways: you can just merge three time series into one three-dimensional time series or you can train an ensemble of three independent classifiers.
We've also merged x, y, and z of accelerometer into one magnitude value, but you can try to use them as separate time series. In this case, for three motion sensors, you'd have nine time series.
Smarter time series chunking
We split our time series into chunks of 25 elements length. This introduces delay when the motion type changes from one to another. This...