## 4 Anomaly Detection
### Characteristics Extraction  
Based on the analyses of activity classification, we can select a corresponding activity to calculate residents' anomaly degree according to properties of various characteristics. There are different methods to select activity for each feature. The following are details:  
1. Duration: When using Duration to calculate, activities of long duration have greater influence on the calculation of anomaly degree, while activities of short duration such as \"leave home\" and  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Activity** & **Duration** & **Scene** & **Start Time** & **Times** & **Incidence** \\ \hline Enter Home & short & regular & irregular & irregular & 1 \\ Leave home & short & regular & irregular & irregular & 1 \\ Dress & short & regular & irregular & irregular & 0.98 \\ Phone & short & regular & irregular & irregular & 0.33 \\ Cook & short & regular & irregular & irregular & 0.22 \\ Eat & short & regular & irregular & irregular & 0.216 \\ Bed toilet transition & short & regular & irregular & irregular & 0.28 \\ Toilet & short & regular & irregular & irregular & 1 \\ Sleep Out of Bed & long & regular & irregular & irregular & 1 \\ Relax & long & regular & irregular & irregular & 0.58 \\ Watch TV & long & regular & irregular & irregular & 1 \\ Entertain guests & long & irregular & regular & irregular & 0.066 \\ Groom & short & regular & regular & irregular & 0.37 \\ Work at Table & short & regular & regular & irregular & 0.05 \\ Read & short & regular & regular & irregular & 0.45 \\ Bathe & short & regular & regular & regular & 0.93 \\ Sleep & long & regular & regular & regular & 0.98 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Characteristics analysis of various activities.  
\"toilet\" have few effects on such calculation, which could almost be neglected. Hence, activities of long duration should be chosen when calculating anomaly degree in this category.
2. Times: Activities with short duration are not suitable for calculation of Duration anomaly degree, but they are fit for calculation of Times anomaly degree. For instance, how often a resident goes to bathroom exerts a great influence on reflecting anomaly degree of his behavior on that day, whereas how long a resident takes in toilet totally in a day is insignificant in calculation. Therefore, activities of short duration should be chosen when calculating anomaly degree in the category of Times. In addition, the activity with relatively stable frequency is more valuable when calculating anomaly degree of Times, meaning that it should be given priority in selection.
3. Start time: Start time of some activities can also be regarded as the evidence to judge if anomalous events occurred. For instance, duration of \"sleep\" may be around a certain number of hours, if they go to bed too early or too late it means they behaved unusually on that day.  
On the basis of analyzing various features of activities, we rule out activities without stability on any of the features described above, such as \"entertain guests\", as this activity only offers no valuable reference for calculating anomaly degree of duration, times and start time, and would affect accuracy of calculation. Table 3 describes activity characteristics which can be used in calculation.