# A Machine Learning Approach for Recognition of Elders' Activities Using Passive Sensors

Anastasios Panagiotis Psathas, Antonios Papaleonidas, Lazaros Iliadis

► To cite this version:

Anastasios Panagiotis Psathas, Antonios Papaleonidas, Lazaros Iliadis. A Machine Learning Approach for Recognition of Elders' Activities Using Passive Sensors. 17th IFIP International Conference on Artificial Intelligence Applications and Innovations (AIAI), Jun 2021, Heronissos, Crete, Greece. pp.157-170, 10.1007/978-3-030-79157-5_14. hal-03789031

HAL Id: hal-03789031

https://inria.hal.science/hal-03789031

Submitted on 27 Sep 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_2.png" /></figure>

ifip

International Federation for Information Processing

This document is the original author manuscript of a paper submitted to an IFIP
conference proceedings or other IFIP publication by Springer Nature. As such, there
may be some differences in the official published version of the paper. Such
differences, if any, are usually due to reformatting during preparation for publication or
minor corrections made by the author(s) during final proofreading of the publication
manuscript.
# A Machine Learning Approach for Recognition of Elders' Activities using Passive Sensors

Anastasios Panagiotis Psathas<sup>1,2[0000-0003-3779-6754]</sup>, Antonios Papaleonidas<sup>1,3[0000-0002-0545-7638]</sup> and Lazaros Iliadis<sup>1,4[0000-0002-6404-1528]</sup>

<sup>1</sup> Department of Civil Engineering, Democritus University of Thrace, Xanthi 67100, Greece

<sup>2</sup>anpsatha@civil.duth.gr, <sup>3</sup>papaleon@civil.duth.gr,

<sup>4</sup>liliadis@civil.duth.gr

**Abstract.** The increasing ageing population around the world, is calling for technological innovations that can improve the lives of elderly people. Real time monitoring their activities is imperative in order to mitigate the detrimental occurrences and dangerous events like falls. The aim of this research is to develop and test a Machine Learning model, capable to determine the activity performed by the elderly in their everyday environment. Data for this research was acquired by setting up two fully monitored rooms, equipped with *Radio Frequency Identification* (RFID) antennas, while subjects who participated in the experiment were wearing a *Wearable Wireless Identification* and *Sensing Platform* (W<sup>2</sup>ISP) tag. The dataset consisted of 14 healthy elders, who would perform four activities namely: sitting on the bed, sitting on a chair, lying in bed and ambulating. Nine independent variables were used, eight of which were obtained by the sensors as raw data vectors and the ninth is the gender. The final data set includes 75,128 records. Totally, 25 Classification Algorithms were used in an effort to determine the more efficient model. The best performance has been achieved by employing the *Bagged Trees* algorithm. A combination of *10-fold Cross validation* and *Grid Search* was used in order to tune the values of the hyperparameters and to avoid any form of overfitting or underfitting. The accuracy and the generalization ability of the optimal model, have been proved by the high values of all performance indices, with a very small deviation for the case of the fourth activity. Thus, this approach can be reliably used (with low cost) by caregivers, hospital staff or anyone else in charge, to watch for potentially dangerous situations for the elders.

**Keywords:** Elders' Activity Recognition, Machine Learning, Bagged Trees, Human Activity Recognition, RFID, W<sup>2</sup>ISP

## 1 Introduction

Rapid development of microelectronics and computer systems over the last decade, led to the implementation of sensors and wearable devices with unprecedented features [22]. High computing power, small size and low cost of sensors and computing devices allow people to interact with appliances in their daily lives [41]. Monitoring and classifying human activities using body-sensors is emerging as an important research area
in Machine Learning (ML) [26]. The use of wearable sensors, such as gyroscopes and accelerometers, for activity recognition, is becoming increasingly popular in relation to computer vision and video analysis [11]. Computer vision and video analysis are limited by the computational resources of mobile and ubiquitous systems, as well as by the diversified, dynamic environment in which such systems need to operate [16].

Sensor-based activity recognition has many potential applications, including health monitoring [12], assisted living [20] and sports coaching [35]. The aim of such efforts is mitigation of activities for the elderly at high risk of falling, especially in hospitals or in age care facilities. It is interesting that such accidents often occur in the bedroom [2]. The rapid increase in the number of old people in our post-modern societies during the recent decades, has called for ways to make their lives easier. Many of these people live alone and in most of the cases they do not have someone to take care of them all the time. Fourth industrial revolution can offer a solution towards this major humanistic and social problem. A correct recognition of such high risk events can lead to an intervention to mitigate an event that can potentially cause further physical injury and mental distress [21]. Accurate recognition of real time activities is imperative as most falls occur during moving in the house i.e. changes of static activities or locations namely: sit to stand, stand to sit or ambulating [29].

The development of models for *Human Activity Recognition* (HAR) is a growing field of study, with many potential applications [37]. In 2006, Pirttikangas et al. [23] tested a Multilayer Perceptron and k-Nearest Neighbor (k-NN) model for HAR of 17 activities, achieving an overall recognition accuracy of 90.61%. In 2011, Casale et al. [9], used the *Random Forest* algorithm, in order to model *walking, climbing stairs, talking with a person, staying standing, and working at computer*. They achieved an overall accuracy around 90%. In 2013, Ahmed and Loutfi [1] performed HAR by using *Case Based Reasoning, Support Vector Machines (SVM) and Neural Networks (NN)*, achieving overall accuracy equal to 0.86, 0.62 and 0.59 respectively for 3 categories of activities (*breathing, walk or run, sitting and relaxing*). In 2018, Brophy et al, [7], proposed a hybrid *Convolutional NN-SVM* model with an overall HAR accuracy equal to 92.3% for 4 activities (*walking and running on a treadmill, low and high resistance bike exercise*). A more recent research was made by Mehdi et al, (2019) [4], where a *Deep NN* was developed for 5 activities (*Standing, Walking, Jogging, Jumping and Sitting*). The model had an F1-score equal to 0.86. In 2020, Psathas et al. [24], applied a combination of *Fast Fourier Transform (FFT) and Bagged Trees* for HAR of 15 subjects who performed 8 different activities, achieving an overall accuracy of 92.8%.

Most of the sensors used in the above researches are bulky, battery powered, strapped or attached to various parts of participant bodies. The use of these sensors for monitoring particularly elders, is unsuitable as reported by user's acceptability studies [14]. Furthermore, these types of sensors also require maintenance such as regular re-charging or replacement of batteries during their operational life. In contrast, a new generation of passive (battery less) sensors, such as sensor-enabled RFID tags [17] are offering exciting new prospects for wearable sensor-based applications. Passive sensors are lightweight and small, hence they can be used for discreet / unobtrusive monitoring. Furthermore passive sensors are maintenance free, as they require no battery while at
the same time they can be easily embedded into garments, turning removal of the mon-
itoring device, especially by cognitively impaired patients, not an easy task [19].

Recent studies show that passive devices can be really efficient for HAR perforance.
In 2014 Wang et al. [40], introduced a wearable system using passive tags for subjects
which achieved an accuracy of 93.6% on HAR. In 2016, Li et al. [23] described an
Activity Recognition System (ARS) for dynamic and complex medical setting, using
passive RFID technology, achieving an accuracy of 96% and 0.74 F-Score for 10 med-
ical activities. In 2018, Ryoo et al. [30], proposed a Backscattering Activity Recognition
Network of Tags (BARNET) which comprises of a network of passive Radio Frequency
(RF) tags, capable to recognize human daily activities with an average error of 6%. In
2016, Shinmoto et al. [34], developed a RFID system with W2ISP tags for generating
bed and chair exit alerts for elders achieving an overall accuracy equal to 94%.

In this paper, the authors have chosen to use the publicly available dataset *Activity recognition with healthy elders, using a battery-less wearable sensor* [39]. The aim of this research is the activity recognition of 14 healthy elders (*siting on bed, siting on chair, lying on bed and ambulating*) in specially designed rooms to simulate hospital conditions using a RFID system with W2ISP tags.

The innovation of this research effort is the extensive use of Machine Learning (ML)
algorithms and the exhaustive search for the determination of the optimal model using
the employment of 10-fold Cross Validation with Grid Search. Data from passive sen-
sors are usually characterized by sparsity and noise [42]. Thus, HAR modeling is a
challenging task.

The rest of the paper is organized as follows. Section 2 describes the dataset and its
features. Section 3 provides the architecture of the proposed model. Section 4 presents
the experimental results and the evaluation of the model. Finally, Section 5 concludes
the research.

## 2 Dataset

As it has already been said, the data set chosen for this study is the publicly available
*Activity recognition with healthy elders using a battery-less wearable sensor* [39]. It
was developed by Roberto Luis Shinmoto Torres, Damith Ranasinghe and Renuka
Visvanathan of the University of Adelaide [38]. It contains 75,128 records of sequential
motion data from 14 healthy elders aged 66 to 86 years old, while performing 4 different
activities wearing passive and battery-less sensors, in two clinic rooms. The records for
each activity and each room are presented in the following Table 1.

The authors' previous effort [24] performed HAR of fifteen subjects aged between
21-55 years old, regarding eight activities (e.g. *ascending/descending stairs*, *cycling*)
using *Photoplethysmography* (PPG) and *Electrocardiogram* (ECG) Sensors. Thus, the
selection of this data set is ideal, as it extends the research effort to a different age group,
with different activities (more static), using passive sensors that have sparsity and noise
in their sampling [42].
<table><caption>**Table 1.** Total Record for each activity and each room</caption><thead><tr><th></th><th>Sitting on bed</th><th>Lying on bed</th><th>Ambulating</th><th>Sitting on chair</th><th>Total</th></tr></thead><tbody><tr><th>Room 1</th><td>15162<br>(25.89%)</td><td>30983<br>(59.04%)</td><td>1956<br>(3.73%)</td><td>4381<br>(8.35%)</td><td>52,482</td></tr><tr><th>Room 2</th><td>1253<br>(5.53%)</td><td>20529<br>(90.65%)</td><td>334<br>(1.47%)</td><td>530<br>(2.34%)</td><td>22,646</td></tr></tbody></table>

## 2.1 The Sensor Platform – Hardware description

The sensing platform used in this study consists of:

* W²ISP compatible passive sensor, enabling RFID tag [32].

* RFID infrastructure consisting of a commercial-off-the-shelf *Ultra high frequency* (UHF) RFID reader (Impinj IPJ-REV-R420-GX11M operating in the frequency range 920–926 MHz) and circularly polarized antennas (Laird S9028PCLJ) [27].

The W²ISP RFID tag contains a triaxial accelerometer (ADXL330) with a flexible antenna for wearability [17] and a microprocessor (MSP430F2132) [34]. W²ISP devices are small, battery free, can be read approximately from a distance of 4 m when worn by a human, weighs approximately 3g and the mass production cost per tag is estimated to be about $3 [8]. When a W²ISP tag is adequately powered, a data stream with an upper bound of 40 Hz sampling rate can be obtained. The W²ISP tag is powered by the energy collected from the electromagnetic field created by the RFID antennas [27].

The RFID infrastructure is also used to collect data from the W²ISP tag where the communication is governed by the air interface protocol ISO 18000-6C [36]. A single RFID compatible sensor platform can communicate with multiple tags and individual W²ISP tags can be identified using the unique electronic identifier communicated by the W²ISP tag along with the sensor data.

The triaxial accelerometer embedded in W²ISP tag measures the acceleration resulting from a participant's motion and the component of gravity along the accelerometer's axes: *frontal* (*a*<sub>f</sub>), *vertical* (*a*<sub>v</sub>), and *lateral* (*a*<sub>l</sub>). The RFID reader provides tag activation and measures the strength of the wireless signal, backscattered from the W²ISP tag, where this information is correlated with the distance between an RFID reader antenna and the W²ISP tag. The power of the radio signal of an observation sent by the tag and received by a specific antenna and measured by an RFID reader is referred to as the received signal strength indicator (RSSI) [27]. It is recorded with the antenna identifier (aID) that captures a given observation from the W²ISP tag. Thus, a single sensor observation can be represented as the five feature vector [*a*<sub>f</sub>, *a*<sub>v</sub>, *a*<sub>l</sub>, RSSI, aID]. The W²ISP tag is attached to silver fabric and the subjects wear it at chest height.
## 2.2 Rooms Setting

Most falls of the elderly occur around the bed and the chair area, both in residential houses and clinics [42]. Thus, the developers of the data set, decided that sampling should be done in areas that simulate hospital rooms. These two rooms were framed with RFID antennas. In room 1, 4 reading antennas were used (one at ceiling level and three at the wall), while in rooms 2, 3 antennas were used (two at ceiling level and one at the wall) [38]. The antennas were strategically placed so as to cover the maximum space inside the room. Each subject was asked to perform a series of broadly scripted activity routines that were an alternation between activities (1) sitting on bed, (2) lying on bed, (3) sitting on chair and (4) walking from A to B, where A, B are the bed, chair or door [41]. Totally, 10 subjects were recorded for the first room 1, and five for the 2nd. One subject participated in both rooms.

## 2.3 Dataset Features

The data set consists of nine features, eight of which are generated by the W²ISP sensor and by the RFID reader and one is the gender of the subject. The features resulting from the sensor and the reader are presented in Table 2.

<table><caption>**Table 2.** Features from W²ISP Sensor and RFID reader</caption><thead><tr><td>Feature</td><td>Abbreviation</td></tr></thead><tbody><tr><td>Record Time</td><td>tID</td></tr><tr><td>Antenna Identification</td><td>aID</td></tr><tr><td>Acceleration on X axis</td><td>a<sub>x</sub></td></tr><tr><td>Acceleration on Y axis</td><td>a<sub>y</sub></td></tr><tr><td>Acceleration on Z axis</td><td>a<sub>z</sub></td></tr><tr><td>Frequency Channel</td><td>fCH</td></tr><tr><td>Phase</td><td>φ</td></tr><tr><td>Received Signal Strength Indicator</td><td>RSSI</td></tr></tbody></table>

The three axes X, Y and Z are relative to the sensor; where vertical (v), lateral (l) and frontal (f) axes are relative to the subject. The tID refers to time (in seconds) of each record. The features RSSI, fCH, a<sub>v</sub>, a<sub>l</sub>, a<sub>f</sub> and aID were described in Section 2.1. Phase refers to the magnitude that expresses the removal of an oscillating body from its equilibrium position at a given point in time. In radio waves, the phase refers to how far the sensor is from the antenna that recorded the measurement.

The activities performed by the subjects, were observed and recorded along with the label of each activity by a researcher. Thus, alongside the features of the dataset, the label of each activity (Table 3) is included. More information about the dataset can be found in [41], [34], [39], [38] and [42].
<table><caption>Table 3. Activity with the Corresponding Label</caption><thead><tr><th>Activity</th><th>Sitting on bed</th><th>Sitting on chair</th><th>Lying on bed</th><th>Ambulating</th></tr></thead><tbody><tr><th>Activity Label</th><td>1</td><td>2</td><td>3</td><td>4</td></tr></tbody></table>

## 2.4 Dataset Pre-Processing

The dataset provides 60 \*.csv files for room 2 and 28 \*.csv files for room 2. Each \*.csv file includes the eight features from the W²ISP sensor and the RFID reader and the label for each record. The feature *Gender* of the participant is included in the last character \*.csv name. Matlab Platform was chosen, in order to perform the pre-processing of the dataset. Data handling has been achieved by writing code from scratch. The following algorithm1 is presenting in a natural language form, the Matlab Script reading people data.

**Algorithm 1.** The Read_Patiences.m Matlab Script

**Script:** Read_Patiences.m

**Inputs:** The 87 \*.csv files

**Step 1:** For i = 1, 2, ..., 87:

a. Read the iᵗʰ \*.csv file and convert it in Matlab_Table_i (xᵢ rows and 9 columns)

b. Read the title of the iᵗʰ \*.csv file. If the letter M (Male) is included add a column to Matlab_Table_i with xᵢ rows and the value 1. Else, if the letter F (Female) is included add a column to Matlab_Table_i with xᵢ rows and the value 2.

**Step 2:** Append the 87 in one Matlab_Table (x₁ + x₂ + ... + x₈₇ = 75,128 rows and 10 columns)

**Step 3:** Shuffle the rows of the Matlab_Table (to eliminate any pattern on the original data)

**Step 4:** Apply Principal Component Analysis (PCA) [43] at the 9 columns of the table (except label column)

**Step 5:** Discard the columns that PCA indicates (tID feature was selected based on the correlation matrix of PCA, see Table 4) and form the Final_Table (75,128 x 9).

**Step 6:** Split the Final_Table (75,128 x 9) into 2 tables: (1) Train Data (70% of Final_Table), (2) Test Data (30% of Final_Table).

**Outputs:** (1) Train Data (52,724 x 9), (2) Test Data (22,576 x 9)

<table><caption>Table 4. Correlation Matrix for features</caption><thead><tr><th>Correlation</th><th>gender</th><th>tID</th><th>α<sub>v</sub></th><th>α<sub>l</sub></th><th>α<sub>f</sub></th><th>aID</th><th>RSSI</th><th>φ</th><th>fCH</th></tr></thead><tbody><tr><th>gender</th><td>1</td><td>-0,14</td><td>0,25</td><td>-0,08</td><td>0,02</td><td>-0,11</td><td>-0,1</td><td>0,04</td><td>0,01</td></tr><tr><th>tID</th><td>-0,14</td><td>1</td><td>-0,73</td><td>-0,63</td><td>-0,77</td><td>0,09</td><td>0,06</td><td><b>0,82</b></td><td>-0,03</td></tr><tr><th>α<sub>v</sub></th><td>0,25</td><td>-0,73</td><td>1</td><td>-0,06</td><td>0,39</td><td>0,16</td><td>-0,13</td><td>0,05</td><td>0,06</td></tr><tr><th>α<sub>l</sub></th><td>-0,08</td><td>-0,63</td><td>-0,06</td><td>1</td><td>-0,13</td><td>-0,28</td><td>0,03</td><td>-0,02</td><td>-0,03</td></tr><tr><th>α<sub>f</sub></th><td>0,02</td><td>-0,77</td><td>0,39</td><td>-0,13</td><td>1</td><td>-0,04</td><td>-0,16</td><td>0,06</td><td>0,1</td></tr><tr><th>aID</th><td>-0,11</td><td>0,09</td><td>0,16</td><td>-0,28</td><td>-0,04</td><td>1</td><td>-0,2</td><td>0,02</td><td>0,05</td></tr><tr><th>RSSI</th><td>-0,1</td><td>0,06</td><td>-0,13</td><td>0,03</td><td>-0,16</td><td>-0,2</td><td>1</td><td>0,01</td><td>-0,19</td></tr><tr><th>φ</th><td>0,04</td><td><b>0,82</b></td><td>0,05</td><td>-0,02</td><td>0,06</td><td>0,02</td><td>0,01</td><td>1</td><td>-0,05</td></tr><tr><th>fCH</th><td>0,01</td><td>-0,03</td><td>0,06</td><td>-0,03</td><td>0,1</td><td>0,05</td><td>-0,19</td><td>-0,05</td><td>1</td></tr></tbody></table>
# 3 Classification Model

A total of 25 classification algorithms have been employed namely: Fine Tree, Medium Tree, Coarse Tree, Linear Discriminant, Quadratic Discriminant, Linear SVM, Quadratic SVM, Cubic SVM, Fine Gaussian SVM, Medium Gaussian SVM, Coarse Gaussian SVM, Cosine KNN, Coarse KNN, Cubic KNN, Weighted KNN, Fine KNN, Medium KNN, Gaussian Naive Bayes, Kernel Naïve Bayes, Boosted Trees, Bagged Trees, Subspace Discriminant, Subspace KNN, RUSBoost Trees, Ensemble Adaptive Boosting. However only the Bagged Trees algorithm that achieved the highest performance is described in the following chapter.

## 3.1 Bagged Trees

Bagging is a ML method of combining multiple predictors. It is a model's averaging approach. Bagging is a technique generating multiple training sets by sampling with replacement from the available training data. [6] This method was introduced by Leo Breiman, in 1996 and it is the acronym for Bootstrap AGGREGATING. [5]. Bootstrap aggregating improves classification and regression models in terms of stability and accuracy. It also reduces variance and helps to avoid overfitting. It can be applied to any type of classifiers. Bagging is a popular method in estimating bias, standard errors and constructing confidence intervals for parameters. In the case of binary classification, the algorithm creates a classifier H: D→{-1,1} on the base of a training set of example descriptions (in our case played by a document collection) D. The bagging method creates a sequence of classifiers H_m m=1,..., M in respect to the modifications of the training set. These classifiers are combined into a compound model, whose prediction is given as a weighted combination of particular classifier predictions according to the following function 1:

$$H(d_i, c_j) = \text{sign}\left(\sum_{m=1}^{M} a_m H_m(d_i, c_j)\right) \quad (1)$$

The meaning of the above given function can be interpreted as a voting procedure. The research effort [33] describes the theory of classifier voting. Parameters $a_m$, m=1,..., M are determined in such a way that more precise classifiers have stronger influence on the final prediction than less precise classifiers. The precision of base classifiers $H_m$ can be only a little bit higher than the precision of a random classification. That is why these models $H_m$ are called weak classifiers. Bagged Trees use the Breiman's 'Random Forest' (RF) algorithm.

A RF consists of a collection of tree-structured classifiers {$T(x, \Theta_b), b=1,...$} where {$\Theta_b$} are independent identically distributed random vectors and each tree casts a unit vote for the most popular class at input X [28]. The Bagged Trees Algorithm is described in the form of Natural Language in Algorithm 2. The total Number of Trees
is denoted as B. The default value of m in the classification is $\sqrt{p}$ the minimum number of nodes is 1 and the default value of m in regression is $\frac{p}{3}$ where the minimum number of nodes is 5.

**Algorithm 2. Bagged Trees Algorithm**

**Inputs:** Train Data

**Step 1:** For b = 1 to B:

* Create a bootstrap sample C with size N from the training set.

* Build a random tree $T_b$ in the bootstrap sample by following the following steps at each terminal node of the tree until the minimum number of nodes $n_{min}$ reached:

- Select m variables from p randomly

- Select the optimal separation variables from m

- Divide the node into two others

**Step 2:** Give the set of Trees $\{T_{\beta}\}_{1}^{B}$

To predict a new point x:

$$ \text{Regression: } f^{B}(x) = \frac{1}{B} \sum_{b=1}^{B} T_{b}(x) \qquad (2) $$

$$ \text{Classification: } G_{rf}^{B}(x) = \text{majority vote} \{C_{b}(x)\}_{1}^{B} \qquad (3) $$

## 3.2 Tuning of hyperparameters

It has already been said that we have chosen the combination of n-fold Cross Validation and Grid Search. As it is indicated in existing literature [15], this is one of the most widely strategies used in ML [3]. More specifically, the employed procedure is the following:

a) The range and the step (unit of transition to the next value) of the values of the hyperparameters that are examined, is initially defined.

b) Considering all possible values combinations, the best combination of hyperparameters is found. For each combination, its classification accuracy (i.e. the average in 10-folds) is calculated, and the one with the greatest accuracy is optimal

c) After finding the best combination of hyperparameters, step a. is applied with other range and step. New range and new step is defined around the hitherto optimal hyperparameters. Step b is performed, in order to reach in a higher value of classification accuracy. [13].

The process is repeated, shrinking the range and the hyperparameter step even further, until the optimal classification accuracy is achieved.
## 3.3 Evaluation of the Proposed Algorithm

Given the fact that this is a multiclass classification problem the “One Versus All” Strategy was used for the determination of the evaluation indices. Although, accuracy is the overall evaluation index of the developed ML models, it may be misleading. Thus, four more indices have been used to estimate the efficiency of the algorithms [25]. The calculated validation indices are presented in the following Table 5.

<table><caption>Table 5. Calculated indices for the evaluation of the multi-class classification approach</caption><thead><tr><th>Index</th><th>Abbreviation</th><th>Calculation</th></tr></thead><tbody><tr><td><strong>Sensitivity</strong><br>(also known as True Positive Rate or Recall)</td><td>SNS, REC, TPR</td><td>SNS=TP/(TP+FN)</td></tr><tr><td><strong>Specificity</strong><br>(also known as True Negative Rate)</td><td>SPC, TNR</td><td>SPC=TN/(TN+FP)</td></tr><tr><td><strong>Accuracy</strong></td><td>ACC</td><td>ACC=(TP+TN)/(TP+FP+FN+TN)</td></tr><tr><td><strong>F1 Score</strong></td><td>F1</td><td>F1=2·TP/(2·TP+FP+FN)</td></tr><tr><td><strong>Precision</strong><br>(also known as Positive Predictive Value)</td><td>PREC</td><td>PREC=TP/(TP+FP)</td></tr></tbody></table>

The indices TP, TN, FP and FN refer to the True Positive, True Negative, False Positive, False Negative indices respectively. SNS is the measure of the correctly identified positive cases from all the actual positive cases. It is important when the cost of False Negatives is high. In contrast, PREC is the measure of the correctly identified positive cases from all the predicted positive cases. Thus, it is useful when the cost of False Positives is high. SPC is the true negative rate or the proportion of negatives that are correctly identified. The F1 score can be interpreted as the harmonic mean (weighted average) of the Precision and Recall. As it is known from the literature, Accuracy can be seriously considered when the class distribution is balanced while F1 score is a better metric when there are imbalanced classes as in the above case [31].

## 4 Experimental Results

The optimal number of grid divisions for the Grid Search was equal to 10, and we have chosen to employ the typical 10-fold Cross Validation. The hyperparameters that were tuned by the bagged trees algorithm, are the number of trees, the maximum number of branches, and learning rate. Table 6 presents the name of each hyperparameter, the acceptable range of the optimal value (defined for the specific case), and its optimal value.

<table><caption>Table 6. Hyperparameter's name, range of search and optimal value</caption><thead><tr><th>Hyperparameter</th><th>Range</th><th>Optimal Value</th></tr></thead><tbody><tr><td>Number of trees</td><td>10-500</td><td>71</td></tr><tr><td>Maximum number of branches</td><td>1-75319</td><td>4547</td></tr><tr><td>Learning rate</td><td>0,001-0,1</td><td>0,056</td></tr></tbody></table>
Table 7 presents the Confusion Matrix for the Training process. A total of 52,159 observations out of 52,724 have been classified correctly, a percentage of 98.93%. The algorithm erroneously classified only a small particle of the observations. However, these cases are negligible as in total they are 565. The incorrect classifications with significant weight in this Confusion Matrix are those mentioned in cells (4, 1) = 251 and (4, 2) = 58 for which the older person seems to be lying down while actually moving around the room. This means that if an accident occurs at that time, the consequences will be unpleasant as it will not have been properly predicted. But the algorithm works extremely well predicting almost all cases.

<table><caption>**Table 7.** Confusion Matrix for the Training Data</caption><thead><tr><th rowspan="2">Actual Class</th><th colspan="4">Predicted Class</th></tr><tr><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><th>1</th><td><strong>11199</strong></td><td>49</td><td>49</td><td>51</td></tr><tr><th>2</th><td>51</td><td><strong>3330</strong></td><td>0</td><td>27</td></tr><tr><th>3</th><td>25</td><td>1</td><td><strong>36335</strong></td><td>0</td></tr><tr><th>4</th><td><strong>251</strong></td><td><strong>58</strong></td><td>3</td><td><strong>1295</strong></td></tr></tbody></table>

<table><caption>**Table 8.** Evaluation Indices for the Training Data</caption><thead><tr><th>Index</th><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><th>SNS</th><td>0.987</td><td>0.9777</td><td>0.999</td><td><strong>0.806</strong></td></tr><tr><th>SPC</th><td>0.992</td><td>0.998</td><td>0.997</td><td>0.998</td></tr><tr><th>ACC</th><td>0.990</td><td>0.996</td><td>0.999</td><td>0.992</td></tr><tr><th>F1</th><td>0.979</td><td>0.973</td><td>0.999</td><td><strong>0.869</strong></td></tr><tr><th>PREC</th><td>0.97</td><td>0.969</td><td>0.999</td><td>0.943</td></tr></tbody></table>

In order to confirm the effectiveness of the Bagged Trees Algorithm that was developed during the elaboration of this dissertation, it was necessary to test the algorithm on first time seen data. Table 9 presents the Confusion Matrix of the Bagged Trees Algorithm for the Testing data. The algorithm predicts with great accuracy the activity that elders undertake. The correct observations were 22,336 in relation to the total 22,596 contained in the testing data. This means that only 260 cases were wrongly classified with the percentage once again at 98.85%. However, most of the observations that were classified incorrectly are those of the fourth class.

<table><caption>**Table 9.** Confusion Matrix for the Testing Data</caption><thead><tr><th rowspan="2">Actual Class</th><th colspan="4">Predicted Class</th></tr><tr><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><th>1</th><td><strong>4808</strong></td><td>21</td><td>22</td><td>22</td></tr><tr><th>2</th><td>29</td><td><strong>1415</strong></td><td>0</td><td>17</td></tr><tr><th>3</th><td>9</td><td>0</td><td><strong>15569</strong></td><td>2</td></tr><tr><th>4</th><td><strong>117</strong></td><td><strong>20</strong></td><td>1</td><td><strong>544</strong></td></tr></tbody></table>

The very reliable performance has been verified by the indices presented in Table 10. The indicators are very good for almost all classes. The case of class 4 seems to have
slightly reduced performance although the SNS and F1-Score are high. The algorithm is still efficient and can predict the activities performed by elders with relatively high accuracy. Once again, it is clear from the indices, mainly from the SNS and F1-Score, that there is very efficient classification performance with a slightly reduced accuracy in the case of class 4, i.e. the activities of elders that are walking.

This is mainly due to the fact that there is less data in this class and the data set is not completely balanced. The number of instances recorded for class 4 was the smallest compared to the other 3 cases. Nevertheless, the performance is excellent and the accuracy indicators have very high values.

<table><caption>**Table 10.** Evaluation Indices for Testing Data</caption><thead><tr><th>Index</th><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><th>SNS</th><td>0.987</td><td>0.969</td><td>0.999</td><td><strong>0.801</strong></td></tr><tr><th>SPC</th><td>0.991</td><td>0.998</td><td>0.997</td><td>0.998</td></tr><tr><th>ACC</th><td>0.990</td><td>0.996</td><td>0.998</td><td>0.992</td></tr><tr><th>F1</th><td>0.978</td><td>0.970</td><td>0.999</td><td><strong>0.861</strong></td></tr><tr><th>PREC</th><td>0.969</td><td>0.972</td><td>0.999</td><td>0.931</td></tr></tbody></table>

# 5 Conclusion and Future Work

A publicly available dataset was used in this research [32]. The data set includes 14 healthy elders who perform the activities (1) sitting on bed, (2) sitting on chair, (3) lying on bed and (4) ambulating, wearing passive and battery-less sensors, in two clinic rooms. After processing the data, the tID variable was removed.

Overall, twenty five classification algorithms were employed. The Bagged Trees algorithm has achieved the optimal performance.

The accuracy rate was high, showing a success rate of 98.93% on Train Data. The performance of the model is sealed by the evaluation indicators which have values very close to one.

Regarding the class 4, "ambulating" it is worth saying that some indicators are slightly lower (SNS = 0.806 and F1-Score 0.869) though still high. This is mainly due to the fact that the data set is not perfectly balanced. The number of records recorded for class 4 was the smallest compared to the other three classes. Furthermore, class 4 is the only one that contains movement of the subject. Thus, it is possible for this movement to affect the performance of the model. Nevertheless, even for this class, the performance of the algorithms is sufficiently satisfactory. The robustness and the generalization ability of the developed model, is confirmed in the testing phase.

Consequently, the model can be adopted by caregivers and hospital staff, in order to monitor the activity of the elderly and adjust the alarms for dangerous situations.

Further extension of this paper could be done in order to optimize the research. A first thought is to develop additional data vectors for the minority class 4, with the well-known and Mathematically Documented, Synthetic Minority Over-sampling Technique
(SMOTE) [10]. Finally, future research could include the development of Deep Learning models after looking for more parameters that could potentially affect the problem.

## References

1. Ahmed, M. U., & Loutfi, A. (2013). Physical activity identification using supervised machine learning and based on pulse rate. International Journal of Advanced Computer Sciences and Applications, 4(7), 210-217.

2. Becker, C., & Rapp, K. (2010). Fall prevention in nursing homes. *Clinics in geriatric medicine*, 26(4), 693-704.

3. Bergstra, J., & Bengio, Y. (2012). Random search for hyper-parameter optimization. The Journal of Machine Learning Research, 13(1), 281-305.

4. Boukhechba, M., Cai, L., Wu, C., & Barnes, L. E. (2019). ActiPPG: Using deep neural networks for activity recognition from wrist-worn photoplethysmography (PPG) sensors. Smart Health, 14, 100082.

5. Breiman, L. (1997). *Arcing the edge*. Technical Report 486, Statistics Department, University of California at Berkeley

6. Breiman, L.: Bagging predictors. Technical Report 421, Department of Statistics, University of California at Berkeley, 1994.

7. Brophy, E., Veiga, J. J. D., Wang, Z., Smeaton, A. F., & Ward, T. E. (2018). An Interpretable Machine Vision Approach to Human Activity Recognition using Photoplethysmograph Sensor Data. arXiv preprint arXiv:1812.00668.

8. Buettner, M., Greenstein, B., Sample, A., Smith, J. R., & Wetherall, D. (2008, October). Revisiting smart dust with RFID sensor networks. In Proceedings of the 7th ACM Workshop on Hot Topics in Networks (HotNets-VII).

9. Casale, P., Pujol, O., & Radeva, P. (2011, June). Human activity recognition from accelerometer data using a wearable device. In *Iberian Conference on Pattern Recognition and Image Analysis* (pp. 289-296). Springer, Berlin, Heidelberg.

10. Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P. (2002). SMOTE: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16, 321-357.

11. Chen, L., Wei, H., & Ferryman, J. (2013). A survey of human motion analysis using depth imagery. Pattern Recognition Letters, 34(15), 1995-2006.

12. Chen, W., Wei, D., Zhu, X., Uchida, M., Ding, S., & Cohen, M. (2005, September). A mobile phone-based wearable vital signs monitoring system. In The Fifth International Conference on Computer and Information Technology (CIT'05) (pp. 950-955). IEEE.

13. Eitrich, T., & Lang, B. (2006). Efficient optimization of support vector machine learning parameters for unbalanced datasets. Journal of computational and applied mathematics, 196(2), 425-436

14. Gövercin, M., Költzsch, Y., Meis, M., Wegel, S., Gietzelt, M., Spehr, J., ... & Steinhagen-Thiessen, E. (2010). Defining the user requirements for wearable and optical fall prediction and fall detection devices for home use. Informatics for health and social care, 35(3-4), 177-187.

15. Hsu, C. W., Chang, C. C., & Lin, C. J. (2003). A practical guide to support vector classification.

16. Junker, H., Amft, O., Lukowicz, P., & Tröster, G. (2008). Gesture spotting with body-worn inertial sensors to detect user activities. Pattern Recognition, 41(6), 2010-2024.

17. Kaufmann, T., Ranasinghe, D. C., Zhou, M., & Fumeaux, C. (2013). Wearable quarter-wave
folded microstrip antenna for passive UHF RFID applications. International Journal of Antennas and Propagation, 2013.

18. Li, X., Yao, D., Pan, X., Johannaman, J., Yang, J., Webman, R., ... & Burd, R. S. (2016, May). Activity recognition for medical teamwork based on passive RFID. In 2016 IEEE international conference on RFID (RFID) (pp. 1-9). IEEE.

19. Miskelly, F. (2004). A novel system of electronic tagging in patients with dementia and wandering. Age and ageing, 33(3), 304-306.

20. Nehmer, J., Becker, M., Karshmer, A., & Lamm, R. (2006, May). Living assistance systems: an ambient intelligence approach. In Proceedings of the 28th international conference on Software engineering (pp. 43-50).

21. Oliver, D. (2004). Prevention of falls in hospital inpatients. Agendas for research and practice.

22. Pantelopoulos, A., & Bourbakis, N. G. (2009). A survey on wearable sensor-based systems for health monitoring and prognosis. IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews), 40(1), 1-12.

23. Pirttikangas, S., Fujinami, K., & Nakajima, T. (2006, October). Feature selection and activity recognition from wearable sensors. In *International symposium on ubiquitous computing systems* (pp. 516-527). Springer, Berlin, Heidelberg.

24. Psathas, A. P., Papaleonidas, A., & Iliadis, L. (2020, November). Machine Learning Modeling of Human Activity Using PPG Signals. In International Conference on Computational Collective Intelligence (pp. 543-557). Springer, Cham.

25. Psathas, A. P., Papaleonidas, A., Papathanassiou, G., Valkaniotis, S., & Iliadis, L. (2020, June). Classification of Coseismic Landslides Using Fuzzy and Machine Learning Techniques. In International Conference on Engineering Applications of Neural Networks (pp. 15-31). Springer, Cham.

26. Ramasamy Ramamurthy, S., & Roy, N. (2018). Recent trends in machine learning for human activity recognition—A survey. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, 8(4), e1254.

27. Ranasinghe, D. C., Sheng, M., & Zeadally, S. (2010). Unique radio innovation for the 21st Century: building scalable and global RFID networks.

28. Rifkin, R., & Klautau, A. (2004). In defense of one-vs-all classification. *Journal of machine learning research*, 5(Jan), 101-141.

29. Robinovitch, S. N., Feldman, F., Yang, Y., Schonnop, R., Leung, P. M., Sarraf, T., ... & Loughin, M. (2013). Video capture of the circumstances of falls in elderly people residing in long-term care: an observational study. The Lancet, 381(9860), 47-54.

30. Ryoo, J., Karimi, Y., Athalye, A., Stanaćević, M., Das, S. R., & Djurić, P. (2018, June). Barnet: Towards activity recognition using passive backscattering tag-to-tag network. In *Proceedings of the 16th Annual International Conference on Mobile Systems, Applications, and Services* (pp. 414-427).

31. Sammut, C., & Webb, G. I. (2017). Encyclopedia of machine learning and data mining. Springer.

32. Sample, A. P., Yeager, D. J., Powledge, P. S., Mamishev, A. V., & Smith, J. R. (2008). Design of an RFID-based battery-free programmable sensing platform. IEEE transactions on instrumentation and measurement, 57(11), 2608-2615.

33. Schapire, R. E., Freund, Y., Bartlett, P., & Lee, W. S. (1998). Boosting the margin: A new explanation for the effectiveness of voting methods. *The annals of statistics*, 26(5), 1651-1686.

34. Shinmoto Torres, R. L., Visvanathan, R., Hoskins, S., Van den Hengel, A., & Ranasinghe,
D. C. (2016). Effectiveness of a batteryless and wireless wearable sensor system for identi-
fying bed and chair exits in healthy elders. *Sensors*, 16(4), 546.

35. Smith, R. E., Zane, N. W., & Smoll, F. L. (1983). Behavioral assessment in youth sports: coaching. Medicine and Science in Sports and Exercise, 15(3), 208-214.

36. Su, Y., Wickramasinghe, A., & Ranasinghe, D. C. (2015, April). Investigating sensor data retrieval schemes for multi-sensor passive RFID tags. In 2015 IEEE International Conference on RFID (RFID) (pp. 158-165). IEEE.

37. Torres, R. L. S., Ranasinghe, D. C., & Shi, Q. (2013, December). Evaluation of wearable sensor tag data segmentation approaches for real time activity classification in elderly. In International Conference on Mobile and Ubiquitous Systems: Computing, Networking, and Services (pp. 384-395). Springer, Cham.

38. Torres, R. L. S., Ranasinghe, D. C., Shi, Q., & Sample, A. P. (2013, April). Sensor enabled wearable RFID technology for mitigating the risk of falls near beds. In 2013 IEEE International Conference on RFID (RFID) (pp. 191-198). IEEE.

39. UCI Machine Learning Repository, https://archive.ics.uci.edu/ml/datasets/Activity+recognition+with+healthy+older+people+using+a+batteryless+wearable+sensor, last accessed 21/3/2021

40. Wang, L., Gu, T., Xie, H., Tao, X., Lu, J., & Huang, Y. (2013, December). A wearable RFID system for real-time activity recognition using radio patterns. In International Conference on Mobile and Ubiquitous Systems: Computing, Networking, and Services (pp. 370-383). Springer, Cham.

41. Wickramasinghe, A., & Ranasinghe, D. C. (2016, March). Recognising activities in real time using body worn passive sensors with sparse data streams: To interpolate or not to interpolate? In proceedings of the 12th EAI International Conference on Mobile and Ubiquitous Systems: Computing, Networking and Services on 12th EAI International Conference on Mobile and Ubiquitous Systems: Computing, Networking and Services (pp. 21-30).

42. Wickramasinghe, A., Ranasinghe, D. C., Fumeaux, C., Hill, K. D., & Visvanathan, R. (2016). Sequence learning with passive RFID sensors for real-time bed-egress recognition in elders. IEEE journal of biomedical and health informatics, 21(4), 917-929.

43. Wold, S., Esbensen, K., & Geladi, P. (1987). Principal component analysis. Chemometrics and intelligent laboratory systems, 2(1-3), 37-52.