## 2 Background
### RNN and BiLSTM  
RNNs are a neural networks often employed for sequential data processing jobs. They are intended to deal with input data with temporal dependencies and where the sequence of the data points is essential. RNNs are excellent at applications, including speech recognition, natural language processing, and time series analysis [22]. The fundamental principle underlying RNNs is that they include feedback links that allow information to persist over time. This feedback mechanism allows the network to maintain memory and  
Figure 1: Flowchart for the proposed methodology. capture long-term dependencies in the input [23]. Unlike feed-forward networks such as convolutional neural networks (CNNs), RNNs feature a recurrent connection where the last hidden state is an input to the next state; Figure 2 presents a typical RNN network. LSTM layers are RNNs meant to learn and interpret long-term relationships in time-ordered data or sequences. Traditional RNNs frequently struggle to capture these long-term dependencies due to issues with \"vanishing\" or \"exploding\" gradients during training. The expressions \"vanishing\" and \"exploding\" gradients apply to circumstances in which the gradients become unexpectedly tiny or excessively big. These problems can impede the network's capacity to develop and sustain interactions over long periods. LSTM helps to address these challenges, improving its ability to grasp and recall information across extended periods. It handles gradient issues by incorporating additional gates that govern the flow of information within the hidden cell, determining what information is preserved for output and the next hidden state. With better control over information flow, LSTMs can more successfully learn and imitate long-term connections in data. LSTMs are more efficient than conventional neural networks such as ANN and CNN, which are less appropriate for collecting temporal correlations among sensor data [24]. A unit LSTM cell structure consists of three gates that control the flow of the data within the network as shown in Figure 3. The first is the forgetting gate (\(f_{t}\)) which eliminates the unnecessary data from the previous LSTM cell. \[f_{t}=\sigma(W_{f}.[h_{t-1},x_{t}]+b_{f}) \tag{1}\]  
where \(\sigma\) denotes the sigmoid activation function while \(W\) represents the weight of forgetting gate. \(h_{t-1}\) and \(x_{t}\) are the output of previous LSTM cell and new input information, respectively. \(b_{f}\) shows the bias vector of the forgetting gate. The input gate determines how much information should be carried for the current memory state based on the sigmoid function. On the other hand, the cell state is updated over time by incorporating new information through the input gate and selectively forgetting information through the forget gate. The process consists of two parts. First, sigmoid function is used to decide whether the new information should be updated or ignored while the other tanh function gives value to the information, representing its level of importance. Figure 2: A typical RNN\(-\)based network. \[i_{t} = \sigma(W_{i}.[h_{t-1},x_{t}]+b_{i}) \tag{2}\] \[C_{t}^{\prime} = \tan\h(\sigma(W_{c}.[h_{t-1},x_{t}]+b_{c})) \tag{3}\]  
Now, the new cell is updated by multiplying \(f_{t}\) with the previous cell and then added to the new memory. \[PC_{t}=\ C_{t-1}\times f_{t}+C_{t}^{\prime}\times\ i_{t} \tag{4}\]  
The output layer finally regulates the output produced by the LSTM at a specific time by the sigmoid activation function. \[O_{t}=\sigma(W_{o}.[h_{t-1},x_{t}]+b_{o}) \tag{5}\]  
Th new hidden layer \(h_{t}\) is determined by  
\[h_{t}=O_{t}\times\tan\h(C_{t}) \tag{6}\]  
On the other hand, the basic idea behind Bi-LSTMs is to have two independent LSTM layers, one processing the sequence ahead and the other processing it backwards. Each LSTM layer has its hidden state, and at each time step, the outputs of both layers are combined [25]. Figure 4 represents the general architecture of uniLSTM and biLSTM. Figure 3: LSTM internal structure for a single unit.