## 4 Materials and Methods
### Features Embedding Branch Extraction  
Based on the 3D CNN, the tensioner has six features that can be interpreted as time series. We suggested an attention-based mechanism for LSTM. The purpose of the attention-based LSTM is to encode the feature tensors into another tensor. The LSTM architecture is a type of RNN [11]. For the processing of time series problems, LSTM is a good option. It was proposed to explore the classic RNN problems or address the gradient vanishing problem. As shown in the proposed architecture Figure 3, the output of 3D CNN \(In_{t}\) in each time interval \(t\) was taken as the input of LSTM after flattening. The peculiar thing about LSTM is it has three gates and memory cells [54]. The names of the three gates are: input gate, forget gate, and output gate [54]. Inside the LSTM structure, information is stored in the memory cell. The purpose of the forget gate is to decide which information passes through the memory cell. The goal of the input gate is to determine what kind of information is added to the cell. The task of the output gate in the next time interval controls the information, and manages what information is referred to next. The input vector is \(In_{t}\) and the output vector is \(h_{t-1}\) in the time interval \(t\)[21]. The input and output vectors are the previous intervals. These intervals were first sent into the forget gate. The forget gate attains the forget gate activation vector \(forget_{t}\). In the following phase, the input gate merges the input \(In_{t}\) and output \(h_{t-1}\). The combined values calculate the activation vector \(input_{t}\). Through activation vectors, we can update the memory cell into \(cell_{t}\). At the previous time interval, the memory cell state vector is \(cell_{t-1}\). Afterward, the output gates are utilized to find the activation vector \(output_{t}\) with the help of \(In_{t}\) and \(h_{t-1}\). Finally, through \(output_{t}\) and \(cell_{t}\) at time interval \(t\), we can get the output vector \(h_{t}\). Formally, the LSTM equations are defined as:  
\[forget_{t}=\sigma(W_{f}In_{t}+U_{f}h_{t-1}+b_{f}) \tag{4}\]  
\[input_{t}=\sigma(W_{i}In_{t}+U_{i}h_{t-1}+b_{i}) \tag{5}\]  
\[cell_{t}=forget_{t}\circ cell_{t-1}+input_{t}\circ tanh(W_{c}In_{t}+U_{c}h_{t -1}+b_{c}) \tag{6}\]  
\[output_{t}=\sigma(W_{o}In_{t}+U_{o}h_{t-1}+b_{o}) \tag{7}\]  
\[h_{t}=output_{t}\circ tanh(cell_{t}) \tag{8}\]  
In the above equations, \(tanh(\cdot)\) is the hyperbolic tangent function, \(\sigma(\cdot)\) is the sigmoid function [55], and \(\circ\) is the Hadamard product. The parameters \(W\) and bias \(b\) are to be learned with different kernel matrices. When LSTM receives the input \(In_{1}\), \(In_{2},\cdots,In_{6}\), from the generated states \(h_{1},h_{2},\cdots,h_{6}\), we capture the different time intervals to capture the interaction between traffic inflow and outflow. The hidden states of the LSTM are based on the attention mechanism. We have decoded these hidden states to generate the six new vectors. The hidden states are illustrated in the features embedding branch of the main-frame architecture Figure 3, in each timestamp t. We need first to calculate the importance of the extent \(Ext_{t,i}\). We calculate the extent between the hidden states \(h_{i}\) and the previous output \(s_{t-1}\) of the decoder LSTM. In the next stage, was normalized it into \(In_{t,i}\). Finally, can calculate the weighted sum of the hidden state \(h_{i}\) and \(In_{t,i}\). The weighted sum gives the context value to be sent to the next timestamp. The hidden state decoding formula is as follows:  
\[Ext_{t,i}=In(s_{t-1},h_{i}) \tag{9}\]  
\[In_{t,i}=\frac{exp(Ext_{t,i})}{\Sigma_{k=1}^{T_{x}}exp(Ext_{t,k})} \tag{10}\]  
\[Con_{t}=\Sigma_{k=1}^{T_{x}}In_{t,i}h_{i} \tag{11}\]  
In the above equations, \(In(\cdot)\) is the one-dimensional convolutional network. The other component of the proposed system is trained with this network. We aimed to capture the correlation between traffic inflow and outflow.