| Algorithm 1: GettingSIA |
| Input:Sq{sq1, sq2,…sqn}, a set of sensor sequence |
| Sensor, sensor set |
| Output:SIA, two-dimensional tuple of sensor importance |
| 1. SIA←Ø; |
| 2. fre←Ø;//fre is a key-value map to counts the number of activities begin with a certain sensor |
| 3. for each sq in Sq: |
| 4. Arr←Ø;//Arr is a tuple that counts whether a sensor is present |
| 5. sv← getT(sq.s1)+1//getT(sq.s1) is employed to get times t of sq.s1 |
| 6. update(fre,{sq.s1,sv}) |
| 7. for each s in sq: |
| 8. Arr←◡{(sq.s1, 1)} |
| 9. end for |
| 10. St←getDict(SIA,sq.s1)//getDict(SIA,sen) is employed to get dict sen |
| 11. St←sum(St, Arr)}//sum is add Arr to St |
| 12. update(SIA,{sq.s1,St}) |
| 13. end for |
| 14. SIA←div(SIA, fre)//div is used to calculate SIA divided by fre |
| 15. return SIA |