# Fine-Grained Mapping Between Daily Activity Features in Smart Homes
## 3 The Proposed Approach
### Coarse Sensors Mapping  
Sensors can be classified by category and function area. For a given smart home \(SH\), the set of equipped sensors \(SEN(SH)=\{s_{1},\,s_{2},\,\ldots\}\) can be partitioned into subsets \(P\_SEN(SH)=\{P_{1},\,P_{2},\ldots\}\). Each subset \(P\subseteq SEN(SH)\) satisfies the conditions: \((\forall s_{1},s_{2}\in P,\)\(s_{1}.\alpha=s_{2}.\alpha)\) \(\land\) \((\forall s_{1},\,s_{2}\in P,\)\(s_{1}.\alpha=s_{2}.\alpha)\). Additionally, for any two distinct subsets \(P_{1}\subseteq SEN(SH)\) and \(P_{2}\subseteq SEN(SH)\), the conditions \(P_{1}\
eq P_{2}\) imply: \((P_{1}\cap P_{2}==\varnothing)\land(\forall s_{1}\in P_{1},\)\(s_{2}\in P_{2},\)\(s_{1}.\alpha\
eq s_{2}.\alpha)\).  
Given two smart homes \(SH1\) and \(SH2\), \(P^{*}\) and \(P^{\#}\) represent the set of equipped sensors within \(SH1\) and \(SH2\), respectively. Coarse sensors mapping \(CM=\{(P^{*},P^{\#})\,|\,P^{*}\in P\_SEN(SH1)\}\)\(\land\)\(P^{\#}\in P\_SEN(SH2)\land\forall s^{*}\in P^{*}\)\(s^{\#}\in P^{\#}\)\(s^{*}.\alpha=s^{\#}.\alpha\)\(s^{*}.\alpha\) can be established between \(P\_SEN(SH1)\) and \(P\_SEN(SH2)\). For instance, consider sensors \(s_{1}\) and \(s_{2}\) equipped in two different smart homes. Both \(s_{1}\) and \(s_{2}\) are infrared motion sensors and are installed in the bedroom. Therefore, \(s_{1}\) is mapped to \(s_{2}\) in the fine sensor mapping.  
Algorithm 2 is used for fine sensor mapping based on coarse sensor mapping. First, the significance degree of each sensor is calculated, as shown in lines 3-4. Then, the significance degrees are clustered, and the clusters are ranked by the value of their centroids, as shown in line 5. Note that for \(\forall 1\leq\) i \(\leq\) \(\lfloor\)\(PG^{*\#}\)\({}_{1},\)\(PG^{*\#}\)\({}_{2},\ldots\)\(\rfloor\), the centroid of \(PG^{*\#}\)\({}_{i}\) is greater than centroid of \(PG^{*\#}\)\({}_{i+1}\). Next, the maximal subset of successive alternate clusters is identified, where the sensors of two adjacent clusters come from different smart homes, as shown in lines 7-18. Then, fine \(pg\) value mappings are determined by iteratively searching for the most similar clusters from the maximal subset of successive alternate clusters, as shown in lines 19-27. Finally, the function getSensorsMapping is used to generate the fine sensor mappings corresponding to the fine pg value mappings. Figure 2 illustrates Algorithm 2. \(PG^{*}\) and \(PG^{\#}\) represent two sets of sensor significance degrees generated from two different smart homes, respectively. For example, in \(PG^{*}\), the pair (\(s^{*}_{1},\,0.35\)) indicates that the significance degree of sensor \(s^{*}_{1}\) is 0.35. Using these significance degrees, sensors are clustered within both \(PG^{*}\) and \(PG^{\#}\). For instance, (\(s^{*}_{2},\,0.26\)) and (\(s^{*}_{5},\,0.22\)) belong to the same cluster. After clustering, all clusters in \(PG^{*}\) and \(PG^{\#}\) are ranked by their centroid values. Clusters are then segmented if two consecutive clusters are from either \(PG^{*}\) or \(PG^{\#}\), resulting in the creation of \(A\_PG\). For example, the sequence \(\{0.35\}\), \(\{0.28,\,0.25,\,0.21\}\), \(\{0.26,\,0.22\}\), \(\{0.14,\,0.12\}\), and \(\{0.09,\,0.07\}\) forms an element of \(A\_PG\). Finally, adjacent clusters with the smallest centroid difference in \(A\_PG\) are grouped together, and the corresponding sensors are mapped.  
Figure 2: Illustration for Algorithm 2.