# Instantaneous Beam Prediction Scheme against Link Blockage in mmWave Communications
## 4 Proposed LSTM-Based Recovery Scheme  
In general, neural networks lack memory blocks, which imposes challenges in predicting sequential data and time series. Hence, recurrent neural networks (RNN) introduce a feedback loop that injects past inputs back to the model, i.e., acting as memory. However, the storage is for short time periods. To solve this problem, LSTM networks are introduced to enhance the memory problem in RNNs by creating both short-term and long-term memory blocks in multiple stacked layers. Namely, the memory blocks (units) are comprised of self-connected cells and a multiplicative gate, thus enabling learn long term dependencies. This structure enhances the detection criterion in sequential and time-series forecasting. Furthermore, LSTM accepts random weight initializations and a variety of state information without the requirement of a prior setting of the input states. Moreover, LSTM networks overcome the problem of vanishing gradients. Finally, they feature low complexity as compared to alternative deep learning algorithms, i.e., the computational complexity per weight and time is modeled as backpropagation through time (BPTT), \(O(1)\)[33].  
In the case of mmWave beam blockage problem, LSTM cells can store previous timestep information in its memory blocks, thus enhancing the beam index accuracy. Hence, four LSTM layers are stacked (chained) to achieve higher precision. The proposed LSTM method is comprised from three phases, i.e., input, hidden layers and output, where each hidden layer is represented by a LSTM cell, where each cell is composed of a state consisting of input \(g_{t}^{in}\), input modulation \(g_{t}^{mod}\), forget \(g_{t}^{f}\) and output \(g_{t}^{out}\) gates that determine information entering the cell state. Along these lines, the prediction scheme adopts LSTM to achieve a suitable solution for time-series prediction of variable sequences lengths.  
Along these lines, consider a MS and BS performing initial beam access procedure using traditional schemes in order to determine the beam directions (indices) that yield in the highest signal at (\(t\))th time step, i.e., \(\left(c_{i}^{t}\right)_{bst}\) and \(\left(p_{j}^{t}\right)_{bst}\). This also includes determining their affiliated \(g_{t}^{i}\) best pointing directions. In notations,  
\[\left(c_{i}^{t},\ p_{j}^{t}\right)_{bst}=max(y_{\text{MS}}). \tag{8}\]  
Once blockage occurs (substituting 1 in the indicator function), then LoS-to-NLoS transition occurs, thus reducing channel capacity and spectral efficiency. Therefore, alternative directions are required here for link recovery and avoiding sessions drops. Specifically, once the instantaneous spectral efficiency \(\delta_{inst}\) (bits/sec/Hz) affiliated with the current beam falls below the threshold value expressed in Equation (9), then beam recovery scheme is triggered. The network then operates link recovery by operating in learning (Mode I) and training (Mode II) modes, as detailed later.  
\[\delta_{inst}<min\Big{\{}\log_{2}(1+10^{0.1(\text{SNR}-\Omega)}),\delta_{max} \Big{\}}, \tag{9}\]  
where \(\Omega\), \(\delta_{max}\) and SNR in order are the loss factor, maximum spectral efficiency [34], and signal-to-noise ratio, respectively.  
\[\text{SNR}=\frac{P_{\text{tr}}G_{\text{MS}}G_{\text{BS}}|h_{l}|^{2}}{\text{ \Psi T}_{0}b}, \tag{10}\]  
where the variable \(\Psi\) represents the Boltzmann constant, T\({}_{0}\) accounts for the operating temperature, and the variable \(b\) denotes the bandwidth. \(G_{\text{MS}}\) and \(G_{\text{BS}}\) in Equation (10) are the array gains at the MS and BS, respectively, i.e., \(G_{\text{MS}}\)\(=g_{n}C_{\text{MS}}\), and \(G_{\text{BS}}\)\(=g_{n}P_{\text{BS}}\), where \(g_{n}\) is the gain for one antenna. The architecture of the proposed LSTM network first proposed in [33] is now presented.