# Outdoor Node Localization Using Random Neural Networks for Large-Scale Urban IoT LoRa Networks +
## 4 Methodology
### Proposed RNN-Based Localization System Using LoRaWAN  
Gelenbe developed RNN as a novel class of ANN [47]. It is composed of N several layers of linked neurons that exchange information signals as impulses; a positive potential (+1) is used for an excited signal and a negative potential (\(-1\)) is used for inhibited signals to the next connected neuron. The potential of every neuron \(i\) at time \(t\) is represented by a nonnegative integer \(K_{i}(t)\). The neuron \(i\) is in an excited state if \(K_{i}(t)>0\) and I is in idle state if \(K_{i}(t)=0\). If neuron \(i\) is excited, it transmits signal information to the next receiving neuron \(j\) at the Poisson rate \(r_{i}\). The transmitted signal can reach neuron \(j\) as an impulse signal in an excited or inhibition state with probabilities \(p^{+}(i,j)\) or \(p^{-}(i,j)\), respectively. Furthermore, the transmitted signal can leave the network with a probability defined with the following mathematical formula:  
\[c(i)+\sum\limits_{j=1}^{N}p^{+}(i,j)+p^{-}(i,j)=1,\forall i, \tag{2}\]  
\[w^{+}(i,j)=r_{i}p^{+}+(i,j)\geq 0, \tag{3}\]  
Likewise  
\[w^{-}(i,j)=r_{i}p^{-}+(i,j)\geq 0. \tag{4}\]  
Equations (2)-(4) combined:  
\[r(i)=(1-c(i))^{-1}\sum\limits_{j=1}^{N}[w^{+}(i,j)+w^{-}(i,j)] \tag{5}\]  
The rate of transmission between neurons in Equation (5) is \(r(i)  
neurons \(y\) and \(z\) is used, where weights \(w^{+}(y,z)\) and \(w^{-}(y,z)\) are updated by  
\[w^{+t}_{y,z}=w^{+(t-1)}_{y,z}-\eta\sum_{i=1}^{n}\gamma_{i}(q^{p}_{j}-y^{p}_{j})[ \frac{\partial q_{i}}{\partial w^{+}_{y,z}}]^{t-1}, \tag{10}\]  
Moreover,  
\[w^{-t}_{y,z}=w^{-(t-1)}_{y,z}-\eta\sum_{i=1}^{n}\gamma_{i}(q^{p}_{j}-y^{p}_{j})[ \frac{\partial q_{i}}{\partial w^{-}_{y,z}}]^{t-1}. \tag{11}\]  
More details about RNN and GD are reported in [37]. In this work, RNN is used to develop our proposed model to accurately map the input to the output using the LoRaWAN Antwerp dataset (RSSI values, Latitude, and Longitude coordinates), and the developed model is used to output any desired unknown X, Y position coordinates. This work considers deg2 utm stand-alone function application to convert GPS coordinates to X, Y vector coordinates using MATLAB R2020b [48]. RNN supervised learning algorithm is considered for training the proposed model to locate each end device in the network service area, and then the trained model is extended further to predict the position of any other LoRa sensor nodes on the same network grid based on end-device RSSI values, as shown in Figure 4.  
We used the LoRaWAN Antwerp dataset [46] to train and test our proposed RNN-LoRa-based localization using the gradient descent algorithm for regression. Different experiment setups are designed, whereby in the first instance, 80% of the available 130,343 total data points are used for training the model with the used LR in different epochs, and the remaining 20% of the dataset is used for testing the model. The proposed RNN model runs k-folds and uses seventy-two input layer neurons, seventy-two hidden layer neurons, and two output layer neurons. Algorithm 1 is the RNN-based localization algorithm used:  
Figure 4: RNN-based RSSI fingerprint localization method.