# Simultaneous Indoor Tracking and Activity Recognition Using Pyroelectric Infrared Sensors
## 7 Discussion  
To compare the effectiveness of RF with other classifiers, we used SVM and naive Bayes to replace RF in both layers of our classifier framework and ran the experiments again [29; 30]. The mean accuracy and standard deviation of 10-fold CV are listed in Table 5. It shows that the accuracy of SVM and naive Bayes is lower than RF. The reason lies in that the decision boundary of naive Bayes is linear, which is not consistent with the fact that the locations of the activities that occurred inside the mock apartment were regional, as shown in the middle column of Figure 12. Within the regions of the chairs and the bed, sitting and lying will occur with high probabilities; outside these regions, walking and standing will occur with high probabilities. Thus, the location of the human target \((x_{t},y_{t})\) is a good indicator. However, using naive Bayes, after assigning the fixed weights to \(x\)-axis and \(y\)-axis separately, the input feature is not linearly separable. The performance of SVM is better than naive Bayes, because the hyperspace produced by the inner product of the input feature can model the non-linearly separable feature. To enhance the performance of naive Bayes and SVM, much effort is needed to segment the activity region manually and to calculate the probability of each activity occurring at each location. The RF can model the activity region inside the mock apartment better than SVM and naive Bayes. RF is composed of many decision trees, which are more interpretable to model the square region where different activities may happen; the decision thresholds applied to \(x\)-axes and \(y\)-axes can be different for each decision tree. The majority vote scheme can boost the decision accuracy. Thus, the decision boundary of RF can be square, which is consistent with the layout of the mock apartment. Furthermore, the RF is also a useful framework to incorporate heterogeneous features such as location, speed, and the duration of successive activities. Figure 13: Mean accuracy and standard deviation of 10-fold cross-validation (CV) for different numbers of decision trees in RF. The number of trees includes 1, 10, 15, 20, 25, 30, 35, 40, 45, 50. The blue line is the performance of the second-layer RF, and the dash with circle is the performance of the first-layer RF. \begin{table}
\begin{tabular}{l l l l l} \hline \hline  & **First-Layer RF** & **Second-Layer RF** & **SVM** & **Naive Bayes** \\ \hline Mean Accuracy & 0.82 & 0.93 & 0.79 & 0.66 \\ Stand Deviation & 0.05 & 0.01 & 0.03 & 0.05 \\ Training Time & - & 1839.14 & 1428.41 & 995.72 \\ Testing Time & - & 0.12 & \(5.25\times 10^{-4}\) & 0.06 \\ \hline \hline \end{tabular} In each cross validation (CV), there is a total of 14,841 data frames for training, 1487 data frames for testing. The unit of training time is the total seconds per CV, and the unit of testing time is seconds per data frame. SVM: support vector machine.  
\end{table} 
Table 5: Comparison of different algorithms. We recorded the training time and testing time of different algorithms, as listed in Table 5. In the host PC, we used MATLAB 2013b for data processing. The CPU of the host PC was an Intel(R) Core(TM) i5-6400 2.70 GHz and 8.00 GB RAM. For each CV, the total training time of naive Bayes was the least, and the RF was the most. In the testing phase, the testing time of SVM was the least, and the RF was the most. However, the testing time of RF for each data frame (two seconds) was 0.12 s, which fulfills the requirement of real-time processing. Because our PIR sensors are ceiling mounted, they will not be easily affected by the existence of obstacles such as the furniture in the mock house. However, when the position of a certain piece of furniture is modified, the location information of the human activities will change as well. We must re-train the RF again, because the statistical distributions of the features are shifted.