There are several directions in which we can proceed to improve our algorithm for motion recognition.
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.
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.