# Adaptive Learning Approach for Human Activity Recognition Using Data from Smartphone Sensors
## 3 Results and Discussion
### Experiments  
The first experiment was performed by modeling activities with separate HMMs consisting of varying amounts of states. The online algorithm was implemented as described above. Several cases of HMM modeling capabilities with different state amounts were analyzed. Five different models were trained with the proposed algorithm--three-state, four-state, five-state, six-state, and seven-state HMM models. Recognition accuracy was calculated during the continuous model parameter re-estimation and recognition. In the first case of the three-state HMM, the accuracy of the model was 89%. Increasing the number of HMM states to four increased the accuracy to 91%. The accuracy stayed at 91% when the number of states was set to five. In the case of a six-state HMM, the accuracy reached 92%, whereas in the case of a seven-state HMM, it was 92%. The results of these experiments show that increasing the state count from three to seven increases classification accuracy. For a better understanding of the performance of these models, the F1-score was calculated for each activity (see Table 1). It gives some insight into how many states are needed to model HMM for the best recognition of each activity. Table 1 shows that running, walking, walking downstairs, and sitting activities have the best F1-score when they are modeled with seven-state HMM. Standing has the highest F1-score (0.78) when it is modeled with the seven- or six-state HMM. Walking upstairs modeled with five- or six-state HMM has the best F1-score. Laying on the floor modeled with the three-state HMM has the best F1-score of 0.9. It is a significant difference compared to the F1-score (0.65) of seven-state HMM. Falling has the highest F1-score (0.96) when this activity is modeled with four states. This experiment showed that different activities should not be modeled with the HMM of the same number of states if we want to achieve the best recognition results. The confusion matrix of the experiments where each activity is modeled with the seven-state HMM is given in Table 2. It shows that running, sitting, and falling are well discriminated among other activities. However, walking, walking upstairs, and walking downstairs are often confused with each other. Other static activities such as standing and lying are confused with each other as well. Table 3 shows the detailed algorithm performance metrics for each activity. Running, sitting, and falling reached the best precision out of all activities. The worst precision result occurred for the sitting activity. The best recall results were reached for running, standing, and fall activities. The worst recall and F1-score results occurred for walking and sitting activities. The overall performance of the algorithm is presented in the last row of Table 3. It shows that the percentage error rate is 8% and the percentage success rate is 92%. While the accuracy of the algorithm is relatively high, precision, recall, and F1-score reached 0.68. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **3 States** & **4 States** & **5 States** & **6 States** & **7 States** \\ \hline
**Running** & 0.91 & 0.89 & 0.91 & 0.91 & **0.94** \\
**Walking** & 0.19 & 0.20 & 0.22 & 0.26 & **0.30** \\
**Walking upstairs** & 0.61 & 0.68 & **0.76** & **0.76** & 0.74 \\
**Walking downstairs** & 0.56 & 0.59 & 0.60 & 0.64 & **0.67** \\
**Standing** & 0.61 & 0.76 & 0.76 & **0.78** & **0.78** \\
**Sitting** & 0.18 & 0.24 & 0.24 & 0.25 & **0.26** \\
**Laying on the floor** & **0.90** & 0.75 & 0.71 & 0.67 & 0.65 \\
**Falling** & 0.92 & **0.96** & 0.89 & 0.93 & 0.93 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: F1-score of each activity modeled with three- to seven-state HMM. The highest F1-score of each activity is in bold. Further experiments were performed with the RHMM algorithm to analyze the recognition rate of activities in a case where all activities are modeled with a single HMM, e.g., one state of HMM represents one activity.