## 3 Methodology  
### Multi-Dense Layer BiLSTM  
The BiLSTM is a variant of the general LSTM [23]. By processing the incoming data sequences from two directions with two independent LSTMs, we utilized the advantages of both prior and future contexts. The LSTM takes a variable-length sequence \(x=x_{1}\), \(x_{2}\),..., \(x_{n}\) as its general input, where \(x_{i}\in\mathbb{R}^{d}\) and \(d\) denotes the features in each time index \(i\). The LSTM preserves its internal hidden state \(h\) in each time index, resulting in a hidden sequence of \(h_{1}\), \(h_{2}\),..., \(h_{n}\). At time index \(t\), the hidden vector \(h_{t}\) is modified as follows:  
\[i_{t}=\sigma(W_{xi}\ x_{t}+W_{ht}h_{t-1}+b_{i}) \tag{1}\]  
\[c_{t}=f_{t}\ \otimes\ c_{t-1}+i_{t}\ \otimes\tanh\Bigl{(}W_{xc}x_{t}+W_{hc}h_{t-1} +b_{f}\Bigr{)} \tag{2}\]  
\[f_{t}=\sigma\Bigl{(}W_{xf}x_{t}+W_{hf}h_{t-1}+b_{f}\Bigr{)} \tag{3}\]  
\[o_{t}=\sigma(W_{o}x_{t}+W_{ho}h_{t-1}+b_{o}) \tag{4}\]  
\[h_{t}=o_{t}\ \otimes\tanh(c_{t}) \tag{5}\]  
Figure 4: Real-time sensor data acquisition visualization using oneM2M browser application. where \(c\), \(\sigma\), and \(\otimes\) express the cell vector, the sigmoid function, and the element-wise multiplication; \(i,f\), and \(o\) indicate to the input, forget, and output gates, respectively. Figure 5 depicts the proposed Multi-Dense Layer BiLSTM model for predicting PM2.5 concentrations. The algorithm took the PM2.5 concentrations data from the raw data, which contain temperature, humidity, PM0.3, PM0.5, PM1, PM5, and PM10 concentrations. Later, their values are standardized into a range of 0 to 1. The processed dataset is sent into the model for training, and the learned model is then utilized to forecast PM2.5 levels. The BiLSTM layer is made up of two LSTM layers: a forward layer and a backward layer. The input is recognized by the forward layer \(l_{t}^{f}\) as ascending range, i.e., \(t=1\), 2, 3,..., \(T\). Backward layer \(l_{t}^{b}\), on the other hand, considers the input in descending order, i.e., \(t=T\)..., 3, 2, 1. As a result, \(l_{t}^{f}\) and \(l_{t}^{b}\) can be combined to generate the output \(y_{t}\). Because they use the same backpropagation through time (BPTT) training mechanism as LSTM networks, BiLSTMs are computationally inexpensive [24]. The backward LSTM layer output sequence \(l_{t}^{b}\) is calculated using reversed inputs from time \(t-2\) to \(t-n\), the same as the forward LSTM layer output sequence \(l_{t}^{f}\). These output sequences are then passed into the function, which combines them into a \(y_{t}\) output vector. The final output of a BiLSTM layer can be represented as a vector, \(Y_{t}=\{y_{t-n}\),..., \(y_{t+2}\}\), where the last element, \(y_{t+2}\), is the estimated PM2.5 concentration for the following iteration, similar to the LSTM layer [25]. All the constructed LSTM networks in this study make use of the bidirectional feature. The mathematical equations constituting the BiLSTM model are as follows:  
\[l_{t}^{f}=\tan\ h\left(W_{xl}^{f}x_{t}+W_{ll}^{f}l_{t-1}^{f}\ +l_{h}^{f}\ \right) \tag{6}\]  
\[l_{t}^{b}=\tan\ h\left(W_{xl}^{b}x_{t}+W_{ll}^{b}l_{t+1}^{b}\ +l_{h}^{b}\ \right) \tag{7}\]  
\[y_{t}=(W_{ly}^{f}l_{t}^{f}+W_{ly}^{b}l_{t}^{b}+y_{y}) \tag{8}\]  
Figure 5: Proposed architecture of Multi-Dense Layer BiLSTM model. After the BiLSTM layer has processed the data, it is sent to a multi-dense layer with a linear activation function to give continuous value predictions. The dense layer is an utterly interconnected layer, i.e., all neurons in one layer are connected to those in the following [26]. There are two dense layers used in this proposed architecture. In a neural network, a dense layer is one that is tightly coupled to the layer before it. That is, every neuron in the layer before it is coupled to every neuron in the layer before it. This is the most often used layer in artificial neural network networks [27]. The authors used two units in the first dense layer and one unit in the second dense layer.