## 3 Proposed Method  
### Overview of the Method  
The objective of the considered wireless sensor network is to recognize human activities \(a_{t}\) in successive time steps (\(t\)). In this network, the wearable sensor nodes attached to a person establish a cluster, where one of the nodes acts as cluster head, i.e., receives data from the other nodes and uses them to recognize the user's activity. The recognized human activity is periodically reported by the cluster head to a sink node. of generality, the term \"machine learning algorithm\" is used, which can refer to neural network, decision tree, random forest, support vector machine, etc. Similarly, the data set mentioned here can be composed of different sensor readings. Thus, size of the processed and transmitted data is not determined. Implementation details of the proposed method, for a prototype of wearable sensor network, are discussed in Section 4. ```
1:classification model \(M_{i}\)
2:for each time step \(t\)do
3: collect data \(S_{i,t}\) from own sensors
4: classify collected data - determine \(d_{i,t}=C(S_{i,t},M_{i})\)
5:if\(d_{i,t}=1\)then
6: send \(S_{i,t}\) to cluster head
7:endif
8:endfor
```
**Algorithm 1** Operation of sensor node \(i\)  
As shown in Algorithm 2, the cluster head (node \(i^{*}\)) collects its own sensor readings and waits for data transmitted from the other nodes in its cluster. The available data are then used to recognize current activity of the monitored person. Since the proposed method assumes that only selected data are sent to the cluster head node, an activity recognition algorithm \(R\) is needed, which can deal with incomplete data sets. In general, the activity recognition task, performed by cluster head, is expressed as follows:  
\[\hat{a}_{t}=R(S_{t},M), \tag{2}\]  
where \(M\) is an activity recognition model trained with use of a machine learning algorithm and \(S_{t}\) denotes a set of data transmitted to the cluster head from sensor nodes a time step \(t\):  
\[S_{t}=\{S_{i,t}:d_{i,t}=1\}. \tag{3}\]  
The problem of reducing data transmission at time step \(t\) is defined as follows:  
\[ \begin{array}{ll}\text{minimize}&\text{card}(S_{t})\\ \text{subject to}&\hat{a}_{t}=a_{t},\end{array}  \tag{4}\]  
where \(a_{t}\) is the actual human activity, and \(\text{card}(\cdot)\) denotes cardinality of the set. Note that \(\text{card}(S_{t})\) corresponds to the number of sensor nodes that have to send data at time step \(t\). ```
1:recognition model \(M\)
2:for each time step \(t\)do
3: collect data \(S_{i^{*},t}\) from own sensors
4: wait for data \(S_{t}\) transmitted from sensor nodes
5: recognize activity \(\hat{a}_{t}=R(S_{i^{*},t}\cup S_{t},M)\)
6: send \(\hat{a}_{t}\) to sink
7:endfor
```
**Algorithm 2** Operation of cluster head (node \(i^{*}\))  
The classification models \(M_{i}\), should allow sensor nodes to made decisions \(d_{i,t}\) that determine solution of minimization problem (4). This objective is achieved by appropriate training of the classification models. Application of this proposed method involves the following steps:Collect training data. * Divide the training data into two samples. * Train recognition model \(M\) using the first data sample. * Prepare data for training classification models \(M_{i}\) based on the second data sample. * Train classification models \(M_{i}\). A training data set, collected at the first step, has to include preprocessed sensor readings from all sensor nodes (\(S\)) and information about activities of the monitored persons (\(A\)) for a representative period. Activities are recognized by a human observer. The sensor readings are prepossessed to eliminate noise, aggregate the raw data and reduce their size. Subsequently, the training data set (\(S,A\)) is divided into samples (\(S^{\prime},A^{\prime}\)) and (\(S^{\prime\prime},A^{\prime\prime}\)). Finally, the training procedures (steps 3-5) are performed as discussed in the following subsections. The outline of the proposed method is illustrated by block diagrams in Figures 1 and 2.