## 3 Background and Methods
### Yield Prediction  
#### 3.2.1 Classification Using BILSTM  
The BILSTM [29; 30; 31] used the chosen LASSO characteristics as input to forecast the coconut production for an effective decision-making purpose [32]. In general, the LSTM [33] is an improved version of a recurrent neural network with a similar design. The data is moved from one stage to the next using the RNN and LSTM. Long-term dependencies are where LSTM achieves a high degree of success. However, an LSTM can only categorize the output according to the prior data. Consequently, if the forward data is not taken into account, there is a chance that a single LSTM will result in misclassification. As a result, to improve the categorization, the BILSTM takes into account both historical and future data. As shown in Figure 3, the BILSTM was made up of two LSTM models that functioned simultaneously, whereas Figure 4 depicts the operation of the BILSTM's single LSTM unit. In the overall architecture, BILSTM trained two LSTM models simultaneously, one trained on the data moving from the first time period to the most recent time period (also called the forward direction), and one from the most recent time period to the first time period (also called the backward direction). Following the completion of the models' training, their hidden states were combined. Thus, the BILSTM handled both the incoming and outgoing data.  
Figure 4: Single LSTM unit of BILSTM.  
Figure 3: Architecture of BILSTM.  
The old data may be retained by the LSTM's hidden layers for a brief period of time. Memory cell \(C_{t}\), which is updated in response to the input gate \((i_{t})\) and forget gate \((f_{t})\), is a crucial component of the LSTM.  
The \(i_{t}\) is used to decide the data that is required to be kept in the memory cell, while \(f_{t}\) is required to decide the memory that needs to be discarded from the memory cell. Equations (3)-(8) are used to update the \(C_{t}\) of forward LSTM.  
\[u_{t}^{(f)}=\tanh\Bigl{(}w_{xu}^{(f)}x_{t}+w_{hu}^{(f)}h_{t-1}+b_{u}^{(f)} \Bigr{)} \tag{3}\]  
\[i_{t}^{(f)}=\sigma\Bigl{(}w_{xi}^{(f)}x_{t}+w_{hi}^{(f)}h_{t-1}+b_{i}^{(f)} \Bigr{)} \tag{4}\]  
\[f_{t}^{(f)}=\sigma\[PERSON]{(}w_{xf}^{(f)}x_{t}+w_{hf}^{(f)}h_{t-1}+b_{f}^{(f)} \Bigr{)} \tag{5}\]  
\[C_{t}^{(f)}=f_{t}^{(f)}\bigodot C_{t-1}^{(f)}+i_{t}^{(f)}\bigodot u_{t}^{(f)} \tag{6}\]  
\[O_{t}^{(f)}=\sigma\Bigl{(}w_{x0}^{(f)}x_{t}+w_{ho}^{(f)}h_{t-1}+b_{o}^{(f)} \Bigr{)} \tag{7}\]  
\[fh_{t}=O_{t}^{(f)}\bigodot\tanh(C_{t}^{(f)}) \tag{8}\]  
Equations (9)-(14) show the update of \(C_{t}\) for backward LSTM.  
\[u_{t}^{(b)}=\tanh\Bigl{(}w_{xu}^{(b)}x_{t}+w_{hu}^{(b)}h_{t+1}+b_{u}^{(b)} \Bigr{)} \tag{9}\]  
\[i_{t}^{(b)}=\sigma\Bigl{(}w_{xi}^{(b)}x_{t}+w_{hi}^{(b)}h_{t+1}+b_{i}^{(b)} \Bigr{)} \tag{10}\]  
\[f_{t}^{(b)}=\sigma\Bigl{(}w_{xf}^{(b)}x_{t}+w_{hf}^{(b)}h_{t+1}+b_{f}^{(b)} \Bigr{)} \tag{11}\]  
\[C_{t}^{(b)}=f_{t}^{(b)}\bigodot C_{t-1}^{(b)}+i_{t}^{(b)}\bigodot u_{t}^{(b)} \tag{12}\]  
\[O_{t}^{(b)}=\sigma\Bigl{(}w_{x0}^{(b)}x_{t}+w_{ho}^{(b)}h_{t+1}+b_{o}^{(b)} \Bigr{)} \tag{13}\]  
\[bh_{t}=O_{t}^{(b)}\bigodot\tanh(C_{t}^{(b)}) \tag{14}\]  
where \(x_{t}\) is the input, \(fh_{t}\) t and \(bh_{t}\) are the output of forward and backward LSTM, and \(w_{xi},~{}b_{i},~{}w_{xu},~{}w_{hu},~{}w_{x0},~{}b_{o},~{}w_{xf}\), and \(b_{f}\) are the parameters that need to be learned in BILSTM. Combining the forward and backward LSTM results yields the final output of BILSTM \((H_{T})\), as shown in Equation (15).  
\[H_{T}=w_{x}^{(h)}fh_{t}+w_{h}^{(h)}bh_{t}+b^{(h)} \tag{15}\]  
Hence, the BILSTM uses the past and future background for a better classification. This model measured the divergence between expected and actual crop yields using the loss function. The trained model predicted crop yields by using environmental variables, such as temperature, humidity, and precipitation. By employing this strategy, the model had the ability to comprehend complex relationships among crop yields and variables related to the environment, facilitating precise forecasting.