# Location Based Indoor and Outdoor Lightweight Activity Recognition System
## 3 Outdoor Activity Recognition System
### POI Identification Mechanism
#### 3.1.2 Second Iteration
Otherwise, and as long as the point label is not part of a cluster labeled as 'good' (in which case the process ends directly), a previous check is made again before passing to level 5, if the current point label belongs to a cluster related to any of the clusters (labels) belonging to level 4, or if the current point is static, it is passed to level 5 (as always, using the label of this point as the initial label of level 5). If the condition is not fulfilled, the process ends, the rest of the levels do not belong to the cluster, and only the points belonging to level 1 are part of the real cluster. * Level 5: As in the previous case, the different levels are checked and the corresponding level is passed by updating the labels. If the tag belongs to level 5, it remains at the same level. Otherwise, the analysis is finished and only the level 1 points are part of the cluster. The points obtained from the previous method can belong to more than one level, which implies clusters with different geographical coordinates but which are considered to belong to the same cluster. To determine the real centroid of this cluster, two DBSCAN calculations are performed on the points obtained, one with an eps of 5 m and the other one with 25 m, both with a minimum sample size of 1. In both cases, it is calculated which cluster agglutinates the highest number of points (ignoring static points), and the centroid  
Figure 6: State diagram of the multi-clustering algorithm. is calculated from the points of this cluster. The ratio of the number of points represented by the centroid of eps05 and eps25 is checked. If the ratio is less than 0.5, the eps25 centroid is used (eps05 is too small and has lost precision), otherwise, esp05 is used. Once this process is finished, the route has been clustered. Now it is time to clean the static points and the GPS motion-drifts from the route (following the same algorithm that was used to clean the path in the first iteration). **Post-processing. ** After that, the small deviations from the user's home are cleaned up. First, the home of the user is inferred clustering with DBSCAN the GPS coordinates between 1 AM and 6 AM and selecting as home the largest cluster. The points (or clusters) of the route are iteratively processed and, if the distance is less than a given threshold (30 m) and it is not a good cluster, the user is considered to be at home and the coordinates of the point (or cluster) are replaced by those of his home. This way, any time the user is at home, the points have homogeneous coordinates. Then, a final pass of the clustering algorithm of the initial interaction is made as a final cleaning of the route, aggregating the different static points generated after analyzing the small deviation from the user's home. Finally, we consider that a point of interest has been found if the user has stayed in the same place for a minimum of five minutes. **Testing and validation. ** Once the new algorithm developed in the second iteration has been completed, it is evaluated to measure its accuracy and efficiency. For this purpose, the samples with real mobiles obtained during the testing and evaluation phase of the first iteration are used. As expected, the previous results are improved without detecting any decrease in the efficiency of the previously corrected results. Next, we will see some examples comparing what is obtained directly from the mobiles, the result of the cleaning and clustering algorithm of the first iteration, and the result of the second iteration. In Figure 7 we can see the same example (left) of static-related GPS drifts that was shown when we presented the different kinds of static drifts that we have detected. As it can be seen, there are several drifts (that are also static-jumps, indicated by the yellow dots). Both algorithms can correctly clusterize this kind of drift into one place (that will be a point of interest as the user has been there for more than five minutes). In the example of Figure 8, we can see a big cluster of points (the big cloud of points on the left).