# Location Based Indoor and Outdoor Lightweight Activity Recognition System
## 1 Introduction  
In smart environments one of the most relevant information that can be gathered about users is their position. Continuous monitoring of user's location is crucial when it comes to the development of accurate activity recognition and behavior modeling systems. Nowadays, it is very common to see applications for different purposes using indoor and outdoor positioning systems, including data-driven and knowledge-based methods for monitoring the behavior of elderly people. Therefore, user behavior modeling is one of the most important tasks in intelligent environments [1]. To be aware of what the user is doing and how it is performing the different tasks is essential to be able to properly adapt to their need. Behavior modeling has been used to address problems in different tasks: to adapt and control the energy consumption of the intelligent environments [2], create context-aware smart cities [3, 4] or early risk detection related to different pathologies [5, 6]. One of the main issues when applying behavior modeling techniques is the required underlaying sensor infrastructure to infer the activities they are performing. Most of the activity recognition and behavior modeling approaches rely on dense sensing environments that rely either in physical sensors (passive infrared sensors, contact sensors, smart plugs...) or video to recognize the activities that are being performed by the users, increasing the initial requirements and overall costs of such systems, becoming even more demanding if the final objective is to also recognize the behavior in outdoors, like in a smart city scenario. Accordingly, there are situations where an environment has been adapted to users with special needs or pathologies where having a dense sensor infrastructure is justified. To address those situations, we propose an extension of our previous work [7] on location-based activity recognition systems in two environments: indoor and outdoor. When it comes to the outdoor positioning system, we exploit the semantic location data exposed in services like OSM to identify the activities that the user is performing. Even though the developed behavior model is simpler and less granular than those that need a more complex infrastructure, in this case the hardware requirements are minimal, only a mobile device. Furthermore, one additional benefit of the system we propose is that reduces the burden for the users, getting advantage of the mobile phone, a device that most users are already have with them all the time, not requiring of additional gadgets. To do so, the proposed system consists of two modules: the Point of Interests (POI) identification and semantic location extraction modules. The first one gets as input the location history of a user (GPS coordinates gathered every minute) and applies some data cleaning and clustering processes that are described in depth in the corresponding section, in order to identify those POIs that the user has visited. Then, the semantic location extraction module analyses the previously identified POIs so that we can infer the activities that the user has carried out. To do so, we have developed a building partitioning method in order to improve the performance of the reverse geocoding tool provided by Nominatim ([[https://github.com/osm-search/Nominatim](https://github.com/osm-search/Nominatim)]([https://github.com/osm-search/Nominatim](https://github.com/osm-search/Nominatim)) (accessed on 19 January 2022)), the public Application Programming Interface (API) of OSM. Secondly, the indoor positioning system is mainly based on Bluetooth Low Energy (BLE) technology that can provide information about the user's location in different places (home, stores, malls, etc.). The system requires minimal infrastructure at low cost. Such a system can extend the proposed method to provide a more comprehensive solution in mixed environments where the indoor positioning in places like a home is also needed. The rest of the paper is organized as follows.