# Modeling and Reasoning of Contexts in Smart Spaces Based on Stochastic Analysis of Sensor Data +
###### Abstract  
In the last decade, smart spaces and automatic systems have gained significant popularity and importance. Moreover, as the COVID-19 pandemic continues, the world is seeking remote intervention applications with autonomous and intelligent capabilities. Context-aware computing (CAC) is a key paradigm that can satisfy this need. A CAC-enabled system recognizes humans' status and situation and provides proper services without requiring manual participation or extra control by humans. However, CAC is insufficient to achieve full automatically since it needs manual modeling and configuration of context. To achieve full automation, a method is needed to automate the modeling and reasoning of contexts in smart spaces. In this paper, we propose a method that consists of two phases: the first is to instantiate and generate a context model based on data that were previously observed in the smart space, and the second is to discern a present context and predict the next context based on dynamic changes (e.g., user behavior and interaction with the smart space). In our previous work, we defined \"context\" as a meaningful and descriptive state of a smart space, in which relevant activities and movements of human residents are consecutively performed. The methods proposed in this paper, which is based on stochastic analysis, utilize the same definition, and enable us to infer context from sensor datasets collected from a smart space. By utilizing three statistical techniques, including a conditional probability table (CPT), K-means clustering, and principal component analysis (PCA), we are able to automatically infer the sequence of context transitions that matches the space-state changes (the dynamic changes) in the smart space. Once the contexts are obtained, they are used as references when the present context needs to discover the next context. This will provide the piece missing in traditional CAC, which will enable the creation of fully automated smart-space applications. To this end, we developed a method to reason the current state space by applying Euclidean distance and cosine similarity. In this paper, we first reconsolidate our context models, and then we introduce the proposed modeling and reasoning methods. Through experimental validation in a real-world smart space, we show how consistently the approach can correctly reason contexts. c 2  
this smartening is to enable a transformation from the manual and static world of humans to an automatic and dynamic world. In a smart space, such smart things are integrated, and hence needed, and convenient services are automatically provided. These days, it is no longer a dream for a house to adjust the indoor atmosphere, such as temperature, humidity, and brightness, and to help the residents to cook or clean [1]. Smart space technology has been utilized in other areas, such as educational institutes [2; 3], medical/healthcare centers [4], and industrial facilities [5]. One of the biggest benefits for smart spaces and their automation of services is to enable untouchable applications. Since smart spaces are operated by sensing devices and intelligent systems, human assistance, in which services are physically contacted, is no longer needed. This is surely appropriate and useful during the COVID-19 pandemic, which requires people to maintain social distancing and avoid direct contact. As this worldwide pandemic continues without signs of ending, the need for such smart spaces is increasing, which will accelerate the development of advanced intelligent systems for smart spaces [6; 7; 8; 9; 10]. The performance of smart spaces depends on intelligent systems, which are internally installed. The intelligent systems discern users' current state and determine services that they might need or desire. The initial step in such systems is to accurately understand the context(s) of the space and its users. Thus, a context-aware design is one of the keys to developing intelligent systems for smart spaces.