# A Fast Indoor/Outdoor Transition Detection Algorithm Based on Machine Learning
## 1 Introduction
Some of the mentioned above algorithm depend on the measurement of signals from a large number of visible neighbor cellular towers. However, most of the current smartphones do not support recording measurements from all neighbor cellular towers. Also, in the mentioned above algorithms, all the algorithms except [PERSON] et al. (2018) did not evaluate the indoor and outdoor scene switching delay. On the other hand, it is difficult to obtain satisfactory classification results with only two classification labels, since a variety of signal variations in complex scenarios and the similarity of indoor and outdoor signal sources in IO transition regions. Due to the GNSS signal, light intensity, geomagnetism, Wi-Fi and other sensor features are different in the open outdoors and deep indoors. Distinguishing IO state in this two environment is easy. However, the actual indoor and outdoor scenes encountered in the urban area are not all the above two ideal scenes, such as on the overpass, near the tall buildings, inside the glass curtain wall, close to the indoor patio, etc. We define these ideal and non-ideal indoor and outdoor environments as complex scenes. By defining the categories of complex scenes, we present the diversity of scenes for data collection. For the mentioned above reasons, a lot of previous studies proposed an ambiguous state like semi-outdoor or shallow indoors to obtain better experiments result. Both fixed detection rules or threshold-based methods achieve satisfactory detection accuracy in ideal open outdoors or closed indoors environments, however, the IO detection accuracy of the abovementioned methods significantly decreases or they are even unable to identify the IO transition areas as shown in Figure 1. However, an uncertain status like semi-outdoor and shallow indoors is difficult for many applications to interpret since the environmental characteristics there are not defined. In this paper, we focus on these complex scenarios, but the final detection status only includes indoors and outdoors. Furthermore, the accuracy and transition delay of IO transition delay in complex scenarios is also a problem we are concerned with. To accomplish IO detection in complex scenarios, we must address the following two major challenges. We define the scenes without data collection in the training stage and the scenes without specific parameters as new environments. First, the poor performance of IO detection in the new environment is due to a variety of signal variations, since users may be in new scenarios that not match the training phase, such as in a room, near a window, under an overpass, in the open outdoors and so on. Detecting all environments with fixed rules and constraints is impractical. Second, it is difficult to detect the transition between indoor and outdoor environments correctly within a short time due to the similarity of indoor and outdoor signal sources when switching between indoors and outdoors in complex scenarios. To address both challenges mentioned above, we leverage Global Navigation Satellite System (GNSS) measurements from Android smartphones to detect IO complex environments. Because of the availability and accuracy of satellite signals tend to be less affected by factors other than the environment, we extract spatial geometry distribution, time sequence and statistical features from the GNSS measurements through Android smart mobile devices. Then, we applied supervised machine learning algorithms to predict IO status. Finally, we regard the predicted IO status as the observations of Hidden Markov Model (HMM) [17] to accurately recognize IO status and immediately detect the transition between IO in complex scenarios. To the best of our knowledge, this paper is the first that uses a stacking model with HMM for IO detection. The main contributions of our work are summarized as follows:  
1. We propose a novel IO detection algorithm employing an ensemble model based on stacking.