<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Beijing, China
* Corresponding author.
$ suhardi@chosun.kr (S. A. Junoh); *jypyun@chosun.ac.kr (J. Pyun)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Region Classification using Wi-Fi and Magnetic Field Strength</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Suhardi Azliy Junoh</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jae-Young Pyun</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Information and Communication Engineering, Chosun University</institution>
          ,
          <addr-line>Gwangju</addr-line>
          ,
          <country country="KR">South Korea</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2022</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0001</lpage>
      <abstract>
        <p>The widespread deployment of Wi-Fi access points (APs) provides an appealing candidate for indoor positioning. However, the major drawback to Wi-Fi-based positioning is that utilizing the signal faces several challenges in a dynamic environment. On the other hand, magnetic fields provide long-term stability in an indoor environment. Similarly, the available Wi-Fi APs can supplement the low number of magnetic field elements present in an indoor environment. Therefore, the hybrid use of Wi-Fi and magnetic field data provides several unique characteristics to compensate for the limitations encountered when each is used independently. In this paper, we propose applying the long short-term memory (LSTM) model to the spatial information from Wi-Fi and magnetic fields due to its advantages in time-series prediction and characterization for region classification. The results demonstrate that the proposed approach can perform indoor region classification with each of the values for precision, recall, and F1 scoring above 95.0%.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Indoor region classification</kwd>
        <kwd>Wi-Fi</kwd>
        <kwd>magnetic fields</kwd>
        <kwd>long short-term memory (LSTM)</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        With the growth of mobile computing and Internet of Things technologies, location-based
services (LBS) are becoming an integral part of our lives both indoors and outdoors in fields such
as emergency response services, staf management, and vehicle tracking [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Global positioning
system (GPS) has proven its efectiveness in enabling users to establish their whereabouts
outdoors. However, in indoor environments, the use of GPS can lead to considerable position
calculation errors due to multipath efects, missing line-of-sight between user and satellite, and
complicated settings. Therefore, the challenge of creating an LBS for interior situations with
suficient accuracy and robustness remains.
      </p>
      <p>
        Creating a reliable and accurate LBS is often crucial for applications focused on indoor areas.
Further, the exact needs will depend on the requirements of a particular application. For example,
smart building applications often require the ability to distinguish diferent workplaces. In some
applications, such as emergency response services, locating a mobile device in a subregion [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
rather than a precise location may be suficient because the user may obtain his or her location
inside the subarea via visual inspection. Similarly, in large indoor environments such as airports
and department stores, a few meters of accuracy is suficient to establish visual contact and
discover the appropriate area.
      </p>
      <p>To date, there has been extensive investigation conducted into indoor positioning systems
(IPS) (e.g., Wi-Fi, Bluetooth Low Energy (BLE), ultra-wideband (UWB) and radio frequency
identification (RFID)). These technologies can be categorized into infrastructure-based and
infrastructure-free approaches. The former approach needs hardware and software to execute
IPS, such as Wi-Fi, UWB, and BLE. The latter systems employ commonly available positioning
technologies and can work without extra infrastructure (e.g., Pedestrian dead reckoning (PDR),
magnetic fields). Infrastructure-based methods provide higher accuracy but are costly due to
the infrastructure requirements. In contrast, an infrastructure-free solution provides pervasive
positioning and is less expensive to implement and maintain.</p>
      <p>
        Recently, localization methods using geomagnetic sensors in smartphone-based have piqued
the interest of many researchers owing to the pervasiveness of magnetic fields in indoor
environments and their independence from external infrastructure [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ]. These approaches
use distorted indoor magnetic fields created by ferromagnetic materials (e.g., steel frames and
electrical equipment). Additional infrastructure is unnecessary as geomagnetic data is pervasive.
However, relying solely on magnetic fields does not guarantee high localization accuracy [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
It requires integrating data from additional sensors (i.e., Wi-Fi, BLE, PDR, etc) to increase the
accuracy of IPS among other possible approaches.
      </p>
      <p>This paper proposes LBS based on indoor region classification utilizing Wi-Fi received signal
strength (RSS) and magnetic data. We present the long short-term memory (LSTM) model
by taking advantage of time-series characteristics for classification. The experimental result
is evaluated with the classical machine learning (ML) and deep learning (DL) algorithms to
compare the performance metrics such as precision, recall, and F1 score.</p>
      <p>The remainder of the paper is organized as follows. In section 2, recent literature on
smartphone general localization technologies and fusion method is introduced. The proposed system
is presented in 3. In section 4, we present the experimental setup and the discussion of the
results. Finally 5 concludes this paper.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <sec id="sec-2-1">
        <title>2.1. Smartphone General Localization Technologies</title>
        <p>
          Modern smartphones are embedded with various sensors, making them both communication
tools and sensing equipment [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. These sensors (i.e., wireless, proximity, light, vision and
magnetometer) can be utilized for indoor localization. Such sensors are inexpensive, convenient
and user friendly to the user which provide the ideal platform in IPS system.
        </p>
        <p>
          In recent years, various smartphone-based IPS has been investigated. Among various
localization technologies, localization methods based on wireless signal (Wi-Fi and BLE) are the
most popular approach owing to low cost of infrastructure. The research [
          <xref ref-type="bibr" rid="ref7 ref8 ref9">7, 8, 9</xref>
          ] utilizes the
widely available Wi-Fi signal in an indoor area and proposes the gaussian process regression
method to enrich the sparsely collected fingerprinting signal data. [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] proposes the RSS signal
from BLE beacon, particle filter, and floor plan with map-constraint for indoor navigation inside
the building.
        </p>
        <p>
          The development of internal sensors in smartphones (e.g., acceleromete, gyroscope and
magnetometer) improves IPS accuracy. For example, JustWalk [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] utilized sensors from
smartphones (e.g., accelerometers, compasses, and gyroscopes) to construct user motion traces in
the building’s floorplan. However, the method requires high computation complexities as
various mathematical expressions and visual processing approaches are applied to the acquired
motion traces to recognize the floorplan shape. [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ] proposes magnetic fields derived from
the magnetometer data from the smartphone and Convolutional Neural Networks (CNN) to
locate a user in indoor environments. [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ] proposes an Impulse-radio ultra-wideband IR-UWB
radar for detecting individuals in the indoor environment for two poses (i.e., standing and
lying down). The proposed approach demonstrated robust detection performance in a cluttered
indoor setting in the experiment.
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Data Fusion-based Localization</title>
        <p>
          Many fusion-based localization technologies have been developed by combining two or more
technologies. For example, IndoorWaze [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] utilizes the Wi-Fi fingerprinting and PDR data
collected by the store owner and the customer. The system directs the shopping personnel to
visit the targeted section in a large department store using audio instructions. ViNav [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] is a
low-cost system that utilizes image-based localization and Wi-Fi fingerprinting to identify the
user’s position and calibrate dead-reckoning for the trajectories. However, ViNav required a
significant amount of high-quality photos to build a 3D model of the testbeds. [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ] combines
multiple technologies available in smartphone sensors (e.g., Wi-Fi, PDR, magnetic and light
sensor) to detect building landmarks and a landmark graph can be constructed by identifying
landmarks such as elevators, corners, and stairs.
        </p>
        <p>
          The motivation for combining infrastructure-based (Wi-Fi) and infrastructure-less (magnetic
ifeld) technologies for indoor region classification is that combining the two can compensate
for the drawbacks of each and provide complementary information to improve localization
[
          <xref ref-type="bibr" rid="ref17 ref18 ref19">17, 18, 19</xref>
          ].
        </p>
        <p>
          For example, Magicol [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] and WAIPO [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ] utilize magnetic efilds and Wi-Fi to compare
the measured signals with the fingerprint database. These two systems additionally employ
particle filters to enhance the localization accuracy further. MagFi [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ] and UbiFin [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] propose
the crowdsourcing method to automatically construct the Wi-Fi and magnetic fingerprint
simultaneously while reducing the site survey cost.
        </p>
        <p>Using a Wi-Fi based approach alone sufers from signal attenuation in a dynamic environment,
especially when faced with human mobility and occupancy. However, human mobility and
occupancy have little efect on magnetic fields. Similarly, because data from smartphone sensors
include noise and variation, the magnetic field alone provides poor accuracy due to handshaking
and the user’s movement. The drawbacks can be compensated by combining it with the Wi-Fi
approach. Furthermore, there are almost always Wi-Fi access points (APs) and the magnetic
ifeld generated by many sources in a public indoor environment. Therefore, we can exploit
these two abundant resources in public places for localization.
135272251893510504
.......
) .36
(ym .50
.......672756358554495544 0.45 0.9 1.35 1.8 2.25 2.7 3.15 x3(m.6) 4.05 4.5 4.95 5.4 5.85 6.3 6.75
(a)
44 .540
9
.
46 .530
811
.
48 .252
35172
.
50 ) ..36
52 (ym ..50
55449
.
54 .454
558
.
56 .635
76
.
58 .72 0.45 0.9 1.35 1.8 2.25 2.7 3.15 x3(m.6) 4.05 4.5 4.95 5.4 5.85 6.3 6.75
(b)
54
.
40 .900
315
.
45 .185
22
.
50 ..257</p>
        <p>13
55 ()ym ..5360
454
.
60 .954
54
.
65 .585
6375
.
70 ..62
7 0.45 0.9 1.35 1.8 2.25 2.7 3.15 x3(m.6) 4.05 4.5 4.95 5.4 5.85 6.3 6.75
(c)</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. System overview</title>
      <sec id="sec-3-1">
        <title>3.1. Background</title>
        <p>The rapid change in Wi-Fi RSS has a substantial impact on localization accuracy and is one of
the challenges of Wi-Fi-based IPS. In contrast to Wi-Fi, magnetic fields in indoor environments
exhibit long-term stability. When used in a dynamic environment with human mobility and
occupancy, Wi-Fi-based techniques sufer from a significant loss in positioning accuracy because
of variations in RSS over time. In contrast, human motion has a negligible efect on magnetic
ifeld measurements due to the absence of significant ferromagnetic elements in humans.</p>
        <p>Fig. 1 and Fig. 2 present the heatmap for data collected in the selected scenario. The RSS
and magnetic field information provide a distinctive feature and unique pattern in an indoor
environment, as shown in Fig. 1 and 2. Fig. 3 shows the magnetometer values from the , ,
and -axis collected by a smartphone along the 100-meter corridor. We can see from Fig. 3
that the magnetic field varies from location to location, but the changes are not significant.
The magnetic field’s  and  components are pointed towards the north and east, while the 
component is pointed vertically towards the earth. Therefore, the normalized magnitude  of
the magnetometer is calculated as follows:</p>
        <p>Given the widespread use of Wi-Fi and the pervasiveness of magnetic fields in an indoor
environment, we may be able to acquire both signals concurrently in many places. Anomalies
in the geomagnetic field induced by local disturbances caused by ferromagnetic construction
materials can be employed to enable pervasive positioning technology for an indoor environment
that is not reliant on infrastructure.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. System Architecture</title>
        <p>The architecture of the proposed system is depicted in Fig. 4. First, the corridor area is classified
into 15 diferent regions. Then, RSS values from numerous APs and magnetic field data for each
region are collected to create a dataset for training the model.</p>
        <p>
          During the data collection, we recorded the RSS and magnetic data simultaneously for
each subregion in the corridor. The corresponding RSS reading is set to -200 dBm in the
Android program if the RSS for a specific AP is not detected. We utilize linear [
          <xref ref-type="bibr" rid="ref22">22</xref>
          ] and median
interpolation methods to handle the missing RSS data during the data preprocessing. Using
the interpolation method, we were able to recreate the missing RSS value of each AP in the
specific region by utilizing the spatial correlation of the adjacent region. Then, we feed the data
into our proposed LSTM model for training purposes. Finally, the preprocessed data from each
region is combined into the database according to each location. Here, we divided the dataset
into 80% for training and 20% for testing purposes. The trained LSTM model utilizes the test
data to classify the region during the testing stage.
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Structure of LSTMs</title>
        <p>This paper uses LSTMs for Wi-Fi and magnetic datasets for indoor subarea classification based
on time series data. LSTM is a form of recurrent neural network (RNN) designed to avoid</p>
        <sec id="sec-3-3-1">
          <title>WiFi and magnetic field data collection</title>
        </sec>
        <sec id="sec-3-3-2">
          <title>Region 1</title>
        </sec>
        <sec id="sec-3-3-3">
          <title>RSS + magnetic</title>
        </sec>
        <sec id="sec-3-3-4">
          <title>Region 2</title>
        </sec>
        <sec id="sec-3-3-5">
          <title>RSS + magnetic</title>
        </sec>
        <sec id="sec-3-3-6">
          <title>Region N</title>
        </sec>
        <sec id="sec-3-3-7">
          <title>RSS + magnetic</title>
        </sec>
        <sec id="sec-3-3-8">
          <title>Data preprocessing</title>
        </sec>
        <sec id="sec-3-3-9">
          <title>Database</title>
        </sec>
        <sec id="sec-3-3-10">
          <title>LSTM network</title>
        </sec>
        <sec id="sec-3-3-11">
          <title>Prediction stage</title>
        </sec>
        <sec id="sec-3-3-12">
          <title>Region estimation</title>
          <p>the problem of long-term dependency. Unlike RNN, which exhibits gradient exploding when
dealing with a long-term time series, LSTM employs memory cells and a gated approach to
solve the problem.</p>
          <p>Each LSTM unit manages the learning and forgetting of timing information via a memory
cell and many non-linear gating units. Fig. 5 depicts the structure of an LSTM unit. The three
gates in LSTM (i.e., forget, input and output) manage the memory and performing the update
for cell state information. Given an input of forget gate is ℎ− 1 and , a standard LSTM can be
formulated as follows:</p>
          <p>=  ( · [ℎ− 1, ] + )
where ,   denotes the output, weight and bias of forget gate. Sigmoid is the activation
function which responsible for determining which values to let through (0 or 1) and can be
given as follows:
 =</p>
          <p>1
1 + − 
The second layer is divided into two sections (i.e., sigmoid and ℎ function). During the first
part, an input gate is updated as follows:
(2)
(3)</p>
          <p>c t
Next cell state</p>
          <p>h t
Next hidden state</p>
          <p>In this paper, the LSTM networks are employed for fusing Wi-Fi and magnetic fields based
on the time-series feature. Our final model integrates elements from LSTM and dense neural
networks based on hyperparameter selection. We use a three-layer network comprising two
The second part generates a candidate state value  by ℎ activation layer as
The ℎ activation assigns weightage to the values, determining their level of relevance (-1 to
1), and is formulated as follows:
The next cell state  is determined as follows:
The last stage is to determine the output. First, a sigmoid layer is run to identify which elements
of the cell state are sent to the output. The cell state is then passed via the ℎ function to
shift the values between -1 and 1 multiplied by the sigmoid gate output. The process can be
summarized as follows:</p>
          <p>=  ( · [ℎ− 1, ] + )
 = ℎ( · [ℎ− 1, ] + )
ℎ() =
 − − 
 + − 
 =  * − 1 +  * 
 =  ( · [ℎ− 1, ] + )
ℎ =  * ℎ()
(4)
(5)
(6)
(7)
(8)
(9)
Min-max normalization</p>
          <p>One hot encoder</p>
          <p>LSTM(50)
LSTM(50)</p>
          <p>Dense(15)</p>
          <p>
            LSTM layers with 50 number of hidden states and one dense node for output classification as
shown in Fig. 6. We use min-max normalization to normalize the data [
            <xref ref-type="bibr" rid="ref23">23</xref>
            ] into the range [
            <xref ref-type="bibr" rid="ref1">0,1</xref>
            ]
and one hot encoder to convert a categorical variable into a format that can be used by our
model during data preprocessing. The final layer was used as a sigmoid layer to generate an
LSTM prediction. The sigmoid activation function determines the output values from 0 to 1. We
implemented our model on the Jupyter Notebook platform and trained the model on a computer
with i5-9500 CPU with a 3GHz processor and 32G RAM running on Windows 10. We utilized
the ADAM optimization algorithm with a learning rate of 0.0001 and categorical crossentropy
as our loss function to train our network.
          </p>
        </sec>
      </sec>
      <sec id="sec-3-4">
        <title>3.4. Indoor Region Classification using Machine Learning Algorithms</title>
        <p>There are two types of machine learning algorithms (i.e., parametric and nonparametric models).
In parametric models, we estimate parameters from the training dataset to learn a function that
can classify new data points without needing the original training dataset. Logistic regression
and linear Support Vector Machine (SVM) are two examples of parametric models.
Nonparametric models, on the other hand, cannot be defined by a fixed set of parameters, and the number
of parameters increases proportionally as the training data. Examples of nonparametric models
in ML are K-Nearest Neighbor (KNN), random forest, and decision tree.
3.4.1. K-Nearest Neighbor
KNN is a nonparametric model used for classification by estimating the likelihood that a data
point will become a member of another group based on the similarity of the patterns. It is
a simple yet eficient algorithm and provides a benchmark for comparing against other ML
algorithms. The KNN algorithm can be summarized as follows. First, it chooses a distance metric
and a number of . Second, it locates the k-nearest neighbors from the data to be classified. It
achieves this by calculating the Euclidean distance between the training and test samples in the
dataset and then ranks the distance by increasing order. Finally, it tallies votes to assign class
labels to the category with the highest number of neighbors.
3.4.2. Support Vector Machine
An SVM is an ML model to solve linear and nonlinear problems for classification. In SVM, the
algorithm first draws a line (hyperplane) that provides a decision boundary to segregate the
data into classes. Then, the SVM algorithm finds the points from both classes that lie closest to
the hyperline, and the process is known as "support vectors." The goal is to maximize profit
margins (distance between the support vectors and the hyperline), and the best hyperplane
is the one with the largest margin. To deal with multi-class classification issues ( &gt; 2), 
binary SVM classifiers are used. The th SVM is trained so that samples in the th class are
labeled as positive and the rest as negative. During the classification stage, a test sample is
obtained from each of the  SVMs and labeled based on the classifier with the highest output
among the  classifiers. We adopted the radial basis function as the kernel, considering the
relationship between classes and features is nonlinear.
3.4.3. Random Forest
Random forest is also a supervised ML algorithm for classification. It comprises several decision
trees, with the number of trees increasing the robustness and accuracy of the algorithm. The
random forest delivers a class prediction for each tree, and the class that receives the most votes
becomes the model’s prediction.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experiment and Analysis</title>
      <sec id="sec-4-1">
        <title>4.1. Experimental Setup</title>
        <p>
          The experiment was conducted on the second floor of the university’s building which has an
area measuring 110 m × 16.9 m, as shown in Fig. 7. The environment consists of a number of
main corridors that connect to diferent rooms. A total of 142 APs were detected during the
experiment. To construct the database, the user utilizes the indoor APs’ information (e.g., MAC
address, RSS values, and timestamp) and surrounding magnetic fields. The data was collected by
a single user using a Samsung Note S8 model. The user walked randomly inside each region of
the building for over the course of two hours during the data collection. The sampling frequency
was set between 0.25 Hz and 1 Hz for Wi-Fi localization [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ] to diferentiate the two adjacent
signals. However, the sampling frequency for the magnetic field is much higher (25 Hz). In this
experiment, the Wi-Fi and magnetic fields are sampled at the same frequency of 0.25 Hz; thus,
there will be a variation in RSS data during the random walk instead of a repeated RSS signal.
During data collection, the average walking speed was between 0.65 m/s and 0.8 m/s. Overall,
1815 samples were collected for each area (27225 samples for all 15 regions).
        </p>
        <p>The mobile phone is held in front of the user’s body, and the user can change any direction
during the data collection. To minimize magnetic fluctuations during walking, we fixed the user’s
altitude by having them hold the phone (i.e., hand-held horizontally with the Y-axis towards the
R8
R15
R4
R7</p>
        <p>R6</p>
        <p>R5</p>
        <p>R4</p>
        <p>R3</p>
        <p>R2</p>
        <p>R1
R14</p>
        <p>R13
110 m
(a)
(b)
R5</p>
        <p>R10</p>
        <p>R13</p>
        <p>R14</p>
        <p>R15
heading direction). Because data is automatically collected while the user is walking, the method
of database construction in this study ofers considerable cost-savings. Furthermore, it can be
extended as a crowdsourcing approach in the future. The walking method of collecting the
Wi-Fi and magnetic field data is proposed to overcome the drawbacks of the static point-to-point
method in the conventional fingerprinting approach.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Performance metrics</title>
        <p>Given the true and predicted labels, we utilize the metrics of precision, recall, and F1 score for
model evaluation and comparing with the benchmark algorithm. These metrics are widely used
in evaluating ML settings and our proposed algorithm.</p>
        <p>Since we examine the multiclass classification model with an  =15 region, we used a 15
class confusion matrix to map one region to all classifications. We define the parameters for
each region  as follows:
1.   (  ) = Number of region  is correctly labeled to region . The classifier
predicts a positive sample in a true positive event, and the actual value is positive.
2.   (  ) = Number of region  incorrectly labeled to region . In a false
positive event, the classifier makes a mistake by predicting a positive sample with a
negative model.
3.   (  ) = Number of region  not classified to region . The classifier
predicts a negative result while the actual sample is positive during a false negative event.</p>
        <p>Based upon those definitions, we develop our performance metrics as follows:
4.2.1. Precision
It is characterized as the measure of true-positive to predictive positive. It indicates the fraction
subregion in an indoor environment that was predicted correctly.</p>
        <p>(100%) =</p>
        <p>∑︀=1  
∑︀=1   +  
Fi score is a metric which takes into account both precision (P) and recall (R) and is defined as
follows:
It denotes the ratio of true-positive to the total number of positive classifications. It indicates
the fraction of subregions in an indoor environment that can be accurately classified.
∑︀=1   +</p>
      </sec>
      <sec id="sec-4-3">
        <title>4.3. Result and Discussion</title>
        <p>The proposed LSTM-Sigmoid-5500 method outperforms all ML and DL benchmarks methods
with a classification accuracy of 95.7%. The classification accuracy of the 15 regions in the
indoor environment is displayed in the confusion matrix in Fig 8. As shown in Fig. 8, each
indoor region is correctly identified with the prediction accuracy not going below 90%. It means
that the proposed LSTM-Sigmoid-5500 functions consistently well across diferent areas.</p>
        <p>We tested the performance of the proposed LSTM-Sigmoid-5500 on various numbers of LSTM
units and hidden layers, as shown in Fig. 9. Increasing the number of LSTM units resulted in a
corresponding improvement in accuracy. However, performance can degrade in some cases
when the network goes deeper. Therefore, the best accuracy result is obtained with two hidden
layers and 50 LSTM units per hidden layer, as shown in Fig. 9. Hence, we chose a 2-layer with
50 LSTM units as our model.</p>
        <p>We compare the validation results of a 2-layer LSTM using sigmoid with the softmax activation
function. We selected the same dimensions of the hidden states for all LSTM architectures.
Fig. 10 shows the curves of cross-entropy loss and the accuracies and the cross-entropy loss
of LSTM-Sigmoid and LSTM-Softmax with 5500 epochs. From Fig. 10, it can be observed that
LSTM-Sigmoid always has a lower loss than LSTM-Softmax on the training data. This pattern
is also seen in the test data, especially at the tails of the loss graphs.</p>
        <p>It can be observed that sigmoid provides a lower loss and consequently produces better
accuracy than softmax. In softmax, increasing the probability of one class reduces the overall
(10)
(11)
(12)
2 0.00% 92.42% 7.58% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%
3 0.00% 3.39% 96.61% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%
probability of all other classes because the activation function requires the sum of the
probabilities of the output classes to be one. Conversely, increasing the probability of one class does
not afect the total probability of the other classes when using a sigmoid. This is why sigmoid
outperforms softmax in multi-label classification. As shown in Table 1, the average precision
was 93.9% for KNN, 90.1% for SVM, 88.1% for the random forest, 72.4% for Dense-Softmax-5500,
and 66.2% for Dense-Sigmoid-5500, respectively. Meanwhile, LSTM-Softmax-5500 produces the
lowest precision at 48.7%. The proposed method outperformed the baseline KNN by 1.8%, 2.4%,
and 2.4% in terms of the average precision, recall, and F1 score, respectively. However, compared
to LSTM-Sigmoid-5500, LSTM-Sigmoid-5500 increased the average precision, recall, and F1
score by 47.0%, 50.1%, and 53.5%, respectively. LSTM-Sigmoid-5500 is designed to perform
indoor classification by retrieving the features based on the Wi-Fi and magnetic field dataset.
The accuracy measures of the training and test data are close to each other indicating that the
proposed model is not overfitted. As shown in Fig. 8, the lowest prediction happens at region 8,
which gives the prediction accuracy of 90.8%, where it wrongly predicts regions 4, 6, 12, 13, and
14, respectively. Meanwhile, the highest percentage of misprediction occurs in region 4, with
7.1% predicted as region 9.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions and Future Directions</title>
      <p>This study proposed the creation of an indoor regional classification method through fusing
Wi-Fi and magnetic data collected by smartphone users. An LSTM network was used for data
fusion and region classification based on Wi-Fi and magnetic field time series data. We compared
our proposed LSTM-Sigmoid-5500 system with the other six benchmark schemes (i.e., KNN,
SVM, random forest, LSTM-Softmax-5500, Dense-Sigmoid-5500, and Dense-Softmax-5500).
Performance was analyzed in terms of average precision, recall, and F1 score for the diferent
classification models. The proposed LSTM-Sigmoid-5500 method outperforms other benchmark
methods, addresses the underfitting problem, and works well with time-series data. In the
future, we plan to provide fine-grained localization instead of coarse-grained localization and
improve the localization performance by using landmarks and more advanced ML and clustering
methods. Moreover, we also plan to perform an extensive experiment in diverse scenarios with
diferent dimensions and interference to verify the results.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Acknowledgments</title>
      <p>This work was supported by the National Research Foundation of Korea (NRF) grant funded by
the Korea government (MSIT).(No. NRF-2022R1A2B5B01002385).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Jia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Deng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. H.</given-names>
            <surname>Aghvami</surname>
          </string-name>
          ,
          <article-title>Indoor localization fusing wifi with smartphone inertial sensors using lstm networks</article-title>
          ,
          <source>IEEE Internet of Things Journal</source>
          <volume>8</volume>
          (
          <year>2021</year>
          )
          <fpage>13608</fpage>
          -
          <lpage>13623</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Q.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Wang</surname>
          </string-name>
          , Finccm:
          <article-title>Fingerprint crowdsourcing, clustering and matching for indoor subarea localization</article-title>
          ,
          <source>IEEE Wireless Communications Letters</source>
          <volume>4</volume>
          (
          <year>2015</year>
          )
          <fpage>677</fpage>
          -
          <lpage>680</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Jia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Guo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Real-time indoor localization using smartphone magnetic with lstm networks</article-title>
          ,
          <source>Neural Computing and Applications</source>
          <volume>33</volume>
          (
          <year>2021</year>
          )
          <fpage>10093</fpage>
          -
          <lpage>10110</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Bhattarai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. K.</given-names>
            <surname>Yadav</surname>
          </string-name>
          , H.-S. Gang, J.-Y. Pyun,
          <article-title>Geomagnetic field based indoor landmark classification using deep learning</article-title>
          ,
          <source>IEEE Access 7</source>
          (
          <year>2019</year>
          )
          <fpage>33943</fpage>
          -
          <lpage>33956</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>I.</given-names>
            <surname>Ashraf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y. B.</given-names>
            <surname>Zikria</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Hur</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Park</surname>
          </string-name>
          ,
          <article-title>A comprehensive analysis of magnetic field based indoor positioning with smartphones: Opportunities, challenges and practical limitations</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>228548</fpage>
          -
          <lpage>228571</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S. A.</given-names>
            <surname>Junoh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Subedi</surname>
          </string-name>
          , J.-Y. Pyun,
          <article-title>Smartphone-based indoor navigation system using particle filter and map-constraints</article-title>
          ,
          <source>in: The 9th International Conference on Smart Media and Applications</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>354</fpage>
          -
          <lpage>357</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. C.</given-names>
            <surname>Periaswamy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Patton</surname>
          </string-name>
          ,
          <article-title>Indoor radio map construction and localization with deep gaussian processes</article-title>
          ,
          <source>IEEE Internet of Things Journal</source>
          <volume>7</volume>
          (
          <year>2020</year>
          )
          <fpage>11238</fpage>
          -
          <lpage>11249</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Xue</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Lin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , R. Zimmermann,
          <article-title>Locate the mobile device by enhancing the wifi-based indoor localization model</article-title>
          ,
          <source>IEEE Internet of Things Journal</source>
          <volume>6</volume>
          (
          <year>2019</year>
          )
          <fpage>8792</fpage>
          -
          <lpage>8803</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>W.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Xue</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Lin</surname>
          </string-name>
          ,
          <article-title>Augmentation of fingerprints for indoor wifi localization based on gaussian process regression</article-title>
          ,
          <source>IEEE Transactions on Vehicular Technology</source>
          <volume>67</volume>
          (
          <year>2018</year>
          )
          <fpage>10896</fpage>
          -
          <lpage>10905</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>S. A.</given-names>
            <surname>Junoh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Subedi</surname>
          </string-name>
          , J.-Y. Pyun,
          <article-title>Floor map-aware particle filtering based indoor navigation system</article-title>
          ,
          <source>IEEE Access 9</source>
          (
          <year>2021</year>
          )
          <fpage>114179</fpage>
          -
          <lpage>114191</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>M.</given-names>
            <surname>Elhamshary</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Alzantot</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Youssef</surname>
          </string-name>
          ,
          <article-title>Justwalk: A crowdsourcing approach for the automatic construction of indoor floorplans</article-title>
          ,
          <source>IEEE Transactions on Mobile Computing</source>
          <volume>18</volume>
          (
          <year>2018</year>
          )
          <fpage>2358</fpage>
          -
          <lpage>2371</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>I.</given-names>
            <surname>Ashraf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Hur</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Park</surname>
          </string-name>
          , Minloc:
          <article-title>Magnetic field patterns-based indoor localization using convolutional neural networks</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>66213</fpage>
          -
          <lpage>66227</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>J.-E. Kim</surname>
            ,
            <given-names>J.-H.</given-names>
          </string-name>
          <string-name>
            <surname>Choi</surname>
          </string-name>
          , K.-T. Kim,
          <article-title>Robust detection of presence of individuals in an indoor environment using ir-uwb radar</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>108133</fpage>
          -
          <lpage>108147</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>T.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Han</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y</surname>
          </string-name>
          . Chen,
          <string-name>
            <given-names>R.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , T. Hedgpeth,
          <article-title>Indoorwaze: A crowdsourcingbased context-aware indoor navigation system</article-title>
          ,
          <source>IEEE Transactions on Wireless Communications</source>
          <volume>19</volume>
          (
          <year>2020</year>
          )
          <fpage>5461</fpage>
          -
          <lpage>5472</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>J.</given-names>
            <surname>Dong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Noreikis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Xiao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ylä-Jääski</surname>
          </string-name>
          ,
          <article-title>Vinav: A vision-based indoor navigation system for smartphones</article-title>
          ,
          <source>IEEE Transactions on Mobile Computing</source>
          <volume>18</volume>
          (
          <year>2018</year>
          )
          <fpage>1461</fpage>
          -
          <lpage>1475</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>C.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , P. Patras,
          <string-name>
            <given-names>H.</given-names>
            <surname>Haddadi</surname>
          </string-name>
          ,
          <article-title>Deep learning in mobile and wireless networking: A survey</article-title>
          ,
          <source>IEEE Communications surveys &amp; tutorials 21</source>
          (
          <year>2019</year>
          )
          <fpage>2224</fpage>
          -
          <lpage>2287</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Bo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Shen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <article-title>Magicol: Indoor localization using pervasive magnetic field and opportunistic wifi sensing</article-title>
          ,
          <source>IEEE Journal on Selected Areas in Communications</source>
          <volume>33</volume>
          (
          <year>2015</year>
          )
          <fpage>1443</fpage>
          -
          <lpage>1457</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>F.</given-names>
            <surname>Gu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Niu</surname>
          </string-name>
          , L. Duan,
          <article-title>Waipo: A fusion-based collaborative indoor localization system on smartphones</article-title>
          ,
          <source>IEEE/ACM Transactions on Networking</source>
          <volume>25</volume>
          (
          <year>2017</year>
          )
          <fpage>2267</fpage>
          -
          <lpage>2280</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>X.</given-names>
            <surname>Guo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Shao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Luo</surname>
          </string-name>
          , Wimag:
          <article-title>Multimode fusion localization system based on magnetic/wifi/pdr</article-title>
          , in: 2016
          <source>International Conference on Indoor Positioning and Indoor Navigation (IPIN)</source>
          , IEEE,
          <year>2016</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>H.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Mo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.-H. G.</given-names>
            <surname>Chan</surname>
          </string-name>
          ,
          <article-title>Eficient indoor localization based on geomagnetism</article-title>
          ,
          <source>ACM Transactions on Sensor Networks (TOSN) 15</source>
          (
          <year>2019</year>
          )
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>J.</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.-H. Chow</surname>
            ,
            <given-names>S.-H. G.</given-names>
          </string-name>
          <string-name>
            <surname>Chan</surname>
          </string-name>
          ,
          <article-title>Implicit multimodal crowdsourcing for joint rf and geomagnetic fingerprinting</article-title>
          ,
          <source>IEEE Transactions on Mobile Computing</source>
          (
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>J.</given-names>
            <surname>Talvitie</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Renfors</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. S.</given-names>
            <surname>Lohan</surname>
          </string-name>
          ,
          <article-title>Distance-based interpolation and extrapolation methods for rss-based localization with indoor wireless signals</article-title>
          ,
          <source>IEEE transactions on vehicular technology 64</source>
          (
          <year>2015</year>
          )
          <fpage>1340</fpage>
          -
          <lpage>1353</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>S. M.</given-names>
            <surname>Sultan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Waleed</surname>
          </string-name>
          , J.-Y. Pyun, T.-W. Um,
          <article-title>Energy conservation for internet of things tracking applications using deep reinforcement learning</article-title>
          ,
          <source>Sensors</source>
          <volume>21</volume>
          (
          <year>2021</year>
          )
          <fpage>3261</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>