# Effective Privacy-Preserving Collection of Health Data from a User's Wearable Device
## 4 Proposed Method
### Wearable Device Processing  
Searching for a Set of Salient Data  
As described in Section 3.3, the expected error incurred by using LDP is linearly proportional to the length of the sequence of health data. To mitigate the expected error caused by the perturbation mechanism of LDP, the proposed method first identifies a small amount of salient data, after which it uses LDP to process these data instead of processing the entire health data. Thus, given a health data, the objective of the first phase of wearable device processing is to search for an optimal salient data set that best represents the original health data. For easy explanation, let us focus on the \(i\)-th user \(U_{i}\) and their health data, \(S_{i}=Big((t_{1},x_{1}^{i}),(t_{2},x_{2}^{i}),\cdots,(t_{n},x_{n}^{i})\Big{)}\), represented as a sequence of length \(n\). Note that in the following, for ease of notation, we omit the superscript \(i\) whenever possible. As indicated in Section 3.1, in this study, we consider a scenario in which the collected health data increase monotonically (i.e., \(x_{1}\leq x_{2}\leq x_{3},\cdots,\leq x_{n}\)). Algorithm 1 contains the pseudo-code for computing a salient data set, \(FS=\{(t_{f_{1}},x_{f_{1}}),(t_{2},x_{f_{2}})\cdots(t_{f_{n}},x_{f_{n}})\}\), which is composed of \(m\) elements (i.e., salient data), extracted from \(S_{i}\). The inputs of the algorithm include the health data sequence \(S_{i}\) and the predefined maximum number of salient data \(\alpha\). In the initialization step, the best salient data set, \(FS_{best}\), is initialized such that it contains the first (i.e., \((t_{1},x_{1})\)) and the last (i.e., \((t_{n},x_{n})\)) data value of \(S_{i}\) (lines 1-3). Then, the best error, \(err_{best}\), incurred by using LDP, is estimated with the initial best salient data set by the function \(EstimateError\_by\_LDP()\), which is explained later in this subsection. ```
input:\(S_{i}=\left((t_{1},x_{1}),(t_{2},x_{2}),\cdots,(t_{n},x_{n})\right)\), \(\alpha\)
1\(FS_{best}\leftarrow\emptyset\);
2\(FS_{best}\gets FS_{best}\cup(t_{1},x_{1})\);
3\(FS_{best}\gets FS_{best}\cup(t_{n},x_{n})\);
4\(err_{best}\gets EstimateError\_by\_LDP(S_{i},FS_{best})\);
5\(FS_{cur}\gets FS_{best}\);
6 while\(|FS_{cur}|<\alpha\)do /* Step 1: Find the next best salient data */ \(dist_{min}\leftarrow\infty\);
7 for\(h\gets 2\) to \((n-1)\)do
8\((t_{h},x_{h})\leftarrow GetElementAt(S_{i},h)\);
9 if\((t_{h},x_{h})\
otin FS_{cur}\)then
10\(dist\leftarrow ComputeDistance(S_{i},FS_{cur}\cup(t_{h},x_{h}))\);
11 if\(dist<dist_{min}\)then
12\(h_{min}\gets h\);
13\(dist_{min}\gets dist\);
14
15 end if
16
17 end for
18
19 end for
20\((t_{h_{min}},x_{h_{min}})\gets GetElementAt(S_{i},h_{min})\);
21\(FS_{cur}\gets FS_{cur}\cup(t_{h_{min}},x_{h_{min}})\); /* Step 2: Update the best salient data set if necessary */
22\(err\gets EstimateError\_by\_LDP(S_{i},FS_{cur})\);
23 if\(err<err_{best}\)then
24\(FS_{best}\gets FS_{cur}\);
25\(err_{best}\gets err\);
26
27 end if
28
29 end for
30 return\(FS_{best}\)
```  
**Algorithm 1**Pseudo-code for extracting a set of salient data from a given health data sequence  
The main parts of the algorithm consist of two steps: finding the next best salient data and updating the best salient data set if necessary. In the first step (lines 7-19), the algorithm finds the next salient data by scanning all data in \(S_{i}\) and then adding these data to \(FS_{cur}\). Here, the next salient data is selected in such a way that the distance (which is computed by ComputeDistance() in line 11) between the original health data \(S_{i}\) and the linear line obtained on the basis of salient data set \(FS_{cur}\) is minimized. For example, Figure 2 illustrates the computation of the distance (represented by black dotted lines) between the original health data (represented by a blue curve) and a salient data set (represented by red circles) containing four salient data. In this example, we assume that \(\alpha\) is set to 6 and the salient data set contains 4 salient data.