*3.4. Application of SemiTMC-GMM*

The question is now how to apply the proposed model to recognise lower limb locomotion activities. In our previous work [7], gait cycle was introduced into the estimation of four locomotion activities, and the results show that it can improve the accuracy. As introduced in [29], one gait cycle can be divided into four gait phases, i.e., stance, push-up, swing, and step down. In this work, we are pursuing a method that does not require the sensor to be placed on the feet only. On the contrary, it can be placed on different places of the lower limb, such as thigh, shank, or foot. The segmentation of gait cycle is based on the motion of foot, so similarly we can define 'leg cycle' based on the motion of leg. One leg cycle can be segmented into four leg phases, which are low position, lifting, high position, and dropping.

Let assume the hidden state *X* represents the activity, and *U* be the gait cycle or leg cycle. Thus, the dimension of Λ (*r*) depends on the number of activities; while for Γ, *τ* is equal to 4. The transition of *X* and *U* follows a specific order because the feet move from attaching on the ground to swinging in the air alternately, or the legs switch between lifting to dropping. Therefore, we define a specific transition graph for *X* and *U*. As shown in Figure 2, the numbers 1–4 represent the hidden state *U*, the four gait and leg phases. We can see that *U* transfers from phase 1 to phase 4 and back to phase 1 again cyclically if the activity does not change. While the activity is switching, *U* transfers from phase 1 of the previous activity to phase 2 of the current activity.

**Figure 2.** Hidden state transition graph. The activities represent *X*, and the numbers 1–4 represent *U* and stand for the four gait phases, or leg phases.

The hidden states *H* and *D* are not the final goals of the recognition, and they have no physical meaning neither. For simplification, the dimension of *L* (-) is set to 9. This value was determined by our experience, a too small value will make the results of SemiTMC-GMM no difference from that of TMC-GMM, while a too large value will cost too much time for running the code. The performance of different GMM components number (*κ*) is evaluated on two datasets, as depicted in Section 5.

The observation *Y* is the feature extracted from the sensor readings. The utilized features are the sliding mean value and standard deviation, by calculating the mean value and standard deviation of acceleration and angular rate within a sliding window length. Since IMUs measure 3-dimensional acceleration and angular rate, then the dimension of the observation *Y* (*w*) equals to 12. The initialization of the hidden states is the same as the one in our previous work [7], so it will not be repeated here. Afterward, based on the initial hidden states *v<sup>N</sup>* <sup>1</sup> and features *<sup>y</sup><sup>N</sup>* <sup>1</sup> , the initial conditioned GMM density *<sup>p</sup>*(*yn*|*vn*, *hn*) can be easily obtained if the mixture number *<sup>κ</sup>* is known. When the initialization is done, batch mode EM algorithm can be applied to train the model, which will be described in details in Section 4. Then, the trained model can be used for the batch mode testing, or, as the initial model of on-line EM algorithm.
