# Fine-Grained Mapping Between Daily Activity Features in Smart Homes
## 3 The Proposed Approach
### Significance Degree  
The adjacency relationships between sensor events in a given sensor event stream can be naturally represented as a directed graph. For instance, the directed graph corresponding to the sensor event stream shown in Table 1 is depicted in Figure 1, where sensors are nodes and the adjacency relationships between sensor events are represented by edges. Inspired by the PageRank algorithm, which is designed to evaluate the significance of web pages [55], we propose that the significance degrees of sensors can be determined using the PageRank algorithm, treating sensors as web pages and the adjacency relationships between sensor events as link relationships between web pages. PageRank is used to rank web pages based on their importance. It assumes that a web page linked by many others will have a higher ranking, and a page linked by high-ranking pages will also receive a relatively high ranking. Inspired by this concept, this article proposes a new algorithm to rank entity pairs according to their credibility. The algorithm \begin{table}
\begin{tabular}{l l l l l} \hline \(d\) & \(t\) & _s.id_ & **v** & _dal_ \\ \hline
25 August 2012 & 15/01 & _M008_ & OFF & \\ \hline
25 August 2012 & 15/01 & _M009_ & ON & \\ \hline
25 August 2012 & 15/01 & _M008_ & OFF & \\ \hline
25 August 2012 & 15/02 & _M009_ & OFF & \\ \hline
25 August 2012 & 15/03 & _LS008_ & 25 & \\ \hline
25 August 2012 & 15/05 & _LS004_ & 31 & Sleep \\ \hline
25 August 2012 & 15/06 & _LS003_ & 3 & \\ \hline
25 August 2012 & 15/07 & _LS016_ & 8 & \\ \hline
25 August 2012 & 15/07 & _LS004_ & 8 & \\ \hline
25 August 2012 & 15/09 & _LS008_ & 24 & \\ \hline
25 August 2012 & 15/09 & _MA008_ & OFF & \\ \hline \end{tabular}
\end{table} 
Table 1: A fragment of sensor events stream. is described as follows: Let \(P\) be the set of all involved web pages, and \(u\)\(\rightarrow\)\(v\) denotes that web page \(v\) is linked to web page \(u\). Let \(R\) be the set of pairs \(\{(u,v)\}\)\(u\)\(\rightarrow\)\(v\), \(u\), \(v\in P\}\). Assign \(F(u)\) and \(B(u)\) to \(\{v\)\(\mid\)\((u,v)\in R\}\), representing the set of web pages that link to \(u\) and the set of web pages that \(v\) links to, respectively. Based on this approach, Algorithm 1 is proposed to compute the significance degree of sensors. First, the activation frequency and percentage of each sensor are calculated from the given sensor event stream \(EV\), as shown in lines 2-8 of Algorithm 1. Additionally, the PageRank algorithm is used to determine the significance degrees of each sensor, as outlined in lines 9-21. In this context, \(pg(s)\) represents the PageRank value of a sensor. Input: smart home \(SH\)  
sensor events stream \(EV\) = \(<\)\(cv(s_{1})\), \(cv(s_{2})\),..., \(cv(s_{n})\)\(>\), where \(\forall 1\leq i\leq n-1\), \(ev(s_{i})\cdot\in\)\(\mathit{SEN}(SH)\)  
decay factor \(d\)  
**Output:** set of significance degrees of sensors  
\(PG(SH)\) = \(\{(s_{1},pg(s_{1}))\), \((s_{2},pg(s_{2}))\),...\}  
1. \(sum\)\(\leftarrow\)\(0\)
2. **for each \(s\) in \(\mathit{SEN}(SH)\)**
3.  solve the frequency \(f(s)\) of \(s\) which is activated in \(EV\). 4. \(sum\)\(\leftarrow\)\(sum\) + \(f(s)\)
5. **end for**
6. **for each \(s\) in \(\mathit{SEN}(SH)\)**
7. \(pg(s)\)\(\leftarrow\)\(f(s)/sum\)
8. **end for**
9. **while(true)**
10. **for each \(s\) in \(\mathit{SEN}(SH)\)**
11. \(\mathit{IN}(s)\)\(\leftarrow\)\([s^{*}]\)\(\mathit{ev}(s^{*})\), \(ev(s)\)\(\in\)\(EV\)\(\wedge\)\(ev(s^{*})\)\(\rightarrow\)\(ev(s)\)
12. **for each \(s^{*}\) in \(\mathit{IN}(s)\)**
13. \(\mathit{OUT}(s^{*})\)\(\leftarrow\)\([s^{\#}]\)\(\mathit{ev}(s^{*})\), \(ev(s^{*})\)\(\in\)\(EV\)\(\wedge\)\(ev(s^{*})\)\(\rightarrow\)\(ev(s^{*})\)
14. \(pg(s)\)\(\leftarrow\)\(d^{*}pg(s^{*})\)\(/\)\(\mid\)\(\mathit{OUT}(s^{*})\)\(\mid\)
15. **end for**
16. \(pg(s)\)\(\leftarrow\)\(1-d+pg(s)\)
17. **end for**
18. **if** the rank of each \(s\in\mathit{SEN}(\mathit{SH})\) stops changing by \(pg(s)\)**then**
19. **break**
20. **end if**
21. **end while**
22.