# Improving Human Activity Monitoring by Imputation of Missing Sensory Data: Experimental Study
## 3 Results  
### Data Imputation  
This stage started with the identification of the number of missing samples. A sample rate of 100 Hz for the accelerometer and gyroscope sensors was considered, which corresponds to 500 samples per activity, and a sample rate of 10 Hz for the magnetometer sensor was considered, which corresponds to 50 samples per activity. Thus, as presented in Table 1, there are a lot of missing samples related to theaccelerometer sensor. It shows the number of complete and missing values related to the accelerometer, where the same analysis was performed for the other sensors. The major number of missing samples was verified during walking upstairs. Next, the data segmentation for the further implementation of data imputation techniques was performed. Table 2 shows an excerpt of accelerometer data during walking activity, where it is possible to observe that 50 samples of data are missing. Next, the frequency of 100 Hz was considered, and the values of the next 50 samples were measured. However, Table 3 shows the start of the process, filling the missing values in the missing rows as NULL. After all the missing values were filled as NULL, the data segmentation process was performed, as shown in Table 4. Finally, the KNN imputation method was implemented to extrapolate the NULL values, as shown in Table 5. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Activity**} & \multirow{2}{*}{**Total Records**} & \multirow{2}{*}{**Complete Records**} & \multicolumn{3}{c}{**Records with Missing Samples**} \\ \cline{4-5}  & & & \(\leq\)**10** & **\textgreater{}10** \& **\textgreater{}100** & **\textgreater{}100** \\ \hline Walking & 2000 & 1217 & 317 & 327 & 139 \\ \hline Running & 2000 & 1513 & 403 & 72 & 12 \\ \hline Standing & 2000 & 1601 & 360 & 37 & 2 \\ \hline Walking upstairs & 2000 & 1293 & 173 & 115 & 419 \\ \hline Walking downstairs & 2000 & 1636 & 111 & 75 & 178 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Analysis of missing samples from the accelerometer sensor. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \# & **Timestamp** & **X** & **Y** & **Z** \\ \hline
1 & 1493996698893 & \(-\)2.145 & \(-\)9.174 & 3.802 \\ \hline
2 & 1493996698902 & \(-\)0.612 & \(-\)9.625 & 3.984 \\ \hline
3 & 1493996698914 & \(-\)0.641 & \(-\)10.678 & 3.84 \\ \hline  & & & & \\ \hline
448 & 1493996702662 & \(-\)0.641 & \(-\)8.533 & 3.84 \\ \hline
449 & 1493996702663 & \(-\)0.632 & \(-\)8.399 & 3.61 \\ \hline
450 & 1493996702672 & \(-\)0.526 & \(-\)8.322 & 3.39 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Excerpt of accelerometer sample for walking activity. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \# & **Timestamp** & **X** & **Y** & **Z** \\ \hline
450 & 1493996702672 & \(-\)0.526 & \(-\)8.322 & 3.39 \\ \hline
451 & 1493996702682 & NULL & NULL & NULL \\ \hline
452 & 1493996702692 & NULL & NULL & NULL \\ \hline  & & & & \\ \hline
499 & 1493996703162 & NULL & NULL & NULL \\ \hline
500 & 1493996703172 & NULL & NULL & NULL \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Excerpt of accelerometer sample for walking activity with missing samples filled as NULL. This technique is implemented for the files that have less than 100 missing samples in the case of the accelerometer and gyroscope and 10 missing samples in the case of the magnetometer. If more than 100 samples are missing, this capture should be discarded. Thus, the captures with more than 100 records missing from the accelerometer or gyroscope and the captures with more than 10 records missed from the magnetometer were ignored. The pattern of imputed data is similar to the other values in each capture, as explained in Section 2. Next, Figure 3 shows the representation of the different axis of one capture during walking downstairs, where only 375 records are available. The number of records should be normalized to obtain reliable results in the data classification, i.e., all experiments must have 500 records. It is verified that 125 samples are missing.