# Application of Artificial Intelligence to Forecast Drought Index for the Mekong Delta
## 2 Materials and Methods
### Methodology
#### 2.3.5 Artificial Intelligence Model Selection
It is utilized for the processing, prediction, and classification of time-series data [62]. The LSTM is made up of four neural networks and numerous memory blocks known as cells in a chain structure. A conventional LSTM unit consists of a cell, an input gate, an output gate, and a forget gate. The flow of information into and out of the cell is controlled by three gates, and the cell remembers values over arbitrary time intervals. The LSTM algorithm is well adapted to categorize, analyze, and predict time series of uncertain duration. The cells store information, whereas the gates manipulate memory. There are three entrances:  
* Input gate: It determines which of the input values should be used to change the memory. The sigmoid function determines whether to allow 0 or 1 values through. The tanh function assigns weight to the data provided, determining their importance on a scale of \(-1\) to 1 (Equations (15) and (16)). \[i_{t}=\sigma(W_{i}[h_{t}-1,x_{t}]+b_{i})\] (15) \[C_{t}=\tanh(W_{C}[h_{t}-1,x_{t}]+b_{C})\] (16) where \(W_{i}\) is a weight of input gate, \(b_{i}\) is the bias value on the input gate, \(C_{t}\) is the cell state, \(b_{C}\) is the bias value on cell state, and \(\sigma\) is the sigmoid function. The sigmoid function is defined by Equation (17) \[r_{int}=-\left[\frac{\partial L(y_{i},\ F_{m-1}(x_{i})}{\partial F_{m-1}(x_{i} )}\right]\ \ for\ i=1,\ldots n \tag{8}\]0 (17)
* Forget gate: It finds the details that should be removed from the block. It is decided by a sigmoid function. For each number in the cell state \(Ct-1\), it looks at the preceding state (ht\(-1\)) and the content input (Xt) and produces a number between 0 (omit this) and 1 (keep this), as shown in Equation (18). \[r_{int}=-\left[\frac{\partial L(y_{i},\ F_{m-1}(x_{i})}{\partial F_{m-1}(x_{i} )}\right]\ \ for\ i=1,\ldots n \tag{8}\]1 (18) where \(f_{t}\) is a forget gate, \(\sigma\) is the sigmoid function, \(x_{t}\) is the input value in t order, \(W_{f}\) is the weight of forget gate, \(b_{f}\) is the bias value on the forget gate, and \(h_{t}\) is the output value in t order. The output of the t model is obtained from the output of the previous model or t \(-1\) model t \(-1\). Output gate: The block's input and memory are used to determine the output. The sigmoid function determines whether to allow 0 or 1 values through. The tanh function determines which values are allowed to pass through 0, 1. Furthermore, the tanh function assigns weight to the values provided, determining their relevance on a scale of \(-1\) to 1 and multiplying it with the sigmoid output. (Equations (19)-(20)). \[r_{int}=-\left[\frac{\partial L(y_{i},\ F_{m-1}(x_{i})}{\partial F_{m-1}(x_{i} )}\right]\ \ for\ i=1,\ldots n \tag{8}\]2  
\[r_{int}=-\left[\frac{\partial L(y_{i},\ F_{m-1}(x_{i})}{\partial F_{m-1}(x_{i} )}\right]\ \ for\ i=1,\ldots n \tag{8}\]3  
where W\({}_{o}\) is a weight of output gate, b\({}_{o}\) is the bias value on cell state, C\({}_{t}\) is the cell state, and \(o_{t}\) is the output gate. The Recurrent Neural Network uses Long Short-Term Memory blocks to provide context for how the software accepts inputs and creates outputs. Because the program uses a structure based on short-term memory processes to build longer-term memory, the unit is dubbed a Long Short-Term Memory block. Incorporating Bidirectional LSTM and LSTM with an Attention Layer in the study of SPEI forecasting can be advantageous as they provide advanced skills in capturing temporal relationships and focusing on key areas of the input sequence. A Bidirectional LSTM utilizes a Recurrent Neural Network architecture that processes data in both the forward and backward directions. This enables the model to acquire knowledge from preceding and subsequent states, enhancing its efficacy in comprehending temporal dynamics. The attention mechanism enables the model to choose and concentrate on particular segments of the input sequence that are more pertinent to the prediction task. This can enhance the model's capacity to acquire significant temporal patterns and interconnections.