## 3 Background and Methods
### Yield Prediction
#### 3.2.2 LFSOA-Based Hyperparameter Tuning for BILSTM
\[B=2\times A^{2}\times R\] (19)where R represents the random value inside [0, 1]. * Remain close to the best search agent: Further, the search agents modify the location according to the optimum solution using Equation (20). \[\overset{\rightarrow}{D}_{e}=\left|\overset{\rightarrow}{P}_{N}-\overset{ \rightarrow}{d}_{e}\right|\] (20)  
Exploitation (Attacking)  
The seagulls vary their angle and speed in the migration process. Seagulls fly in the air using their wings and weight. The seagulls move in a spiral way at the \(q\), \(r\), and \(s\) planes in the attack process, as shown in Equations (21)-(23). \[\dot{q} = rad\times\cos(RV) \tag{21}\] \[\dot{r} = rad\times\sin(RV)\] (22) \[\dot{s} = rad\times RV \tag{23}\]  
where in Equation (24), the radius of the spiral turn is represented as rad, and the random value between \(\left[0,\ \ 2\pi\right]\) is indicated as \(RV\). \[rad=\delta\times e^{\gamma RV} \tag{24}\]  
where the logarithm base is denoted as e, and \(\delta\) and \(\gamma\) denotes the spiral shape. Equation (25) shows the new location of seagulls. \[\overset{\rightarrow}{P}_{c}(T)=\left(\overset{\rightarrow}{D}_{e}\times \dot{q}\times\dot{r}\times\dot{s}\right)+\overset{\rightarrow}{P}_{b}(T) \tag{25}\]  
where the optimum result is denoted as \(\overset{\rightarrow}{P}_{c}(T)\). Enhancement Using Levy Flight  
The random walk approach was provided by LF for controlling the local search. This random walk is expressed in Equations (26)-(28). \[A=FC-\left(T\times\left(\frac{FC}{Max(T)}\right)\right)\]0  
\[A=FC-\left(T\times\left(\frac{FC}{Max(T)}\right)\right)\]1  
\[A=FC-\left(T\times\left(\frac{FC}{Max(T)}\right)\right)\]2  
where \(0<\tau\leq 2;A\sim N\big{(}0,\sigma^{2}\big{)};\)\(B\sim N\big{(}0,\sigma^{2}\big{)};\) The gamma function is denoted as \(\Gamma(. );\) the step size is denoted as w; the Levy index is \(\tau;\) and \(A/B\sim N\big{(}0,\sigma^{2}\big{)}\) defines the samples created using Gaussian distribution where the mean is 0 and the variance is \(\sigma^{2}\). A new enhanced portion according to the above-defined mechanism to update the SOA's solution is shown in Equation (29). \[\overset{\rightarrow}{D}_{el}=\left\{ \begin{array}{ll}\overset{\rightarrow} {D}_{el},&F\left(\overset{\rightarrow}{D}_{el}\right)>F\left(\overset{ \rightarrow}{D}_{e}\right)\\ \overset{\rightarrow}{D}_{e},&\textit{Otherwise}\end{array} \right. \tag{29}\]effectiveness in producing superior results. The LFSOA was executed until it reached the maximum iteration. The flowchart for the LFSOA is shown in Figure 5.  
The hyperparameters optimized using the LFSOA were used in the BILSTM for an effective coconut yield prediction. Moreover, the unwanted features were eliminated using the LASSO, which also helps to minimize the error rate and enhances the classification. The statistical measures comprised the MAE, MSE, RMSE, and coefficient of determination (R\({}^{2}\)), which are expressed in Equations (30)-(33). \[R^{2}=\left\{\frac{1}{N}\times\frac{\sum_{i=1}^{N}\left(U_{i}-\overline{U} \right)\times\left(V_{i}-\overline{V}\right)}{\left(\sigma_{U}-\sigma_{V} \right)^{2}}\right\}^{2} \tag{30}\]  
\[MSE=\frac{1}{N}\sum_{i=1}^{N}\left(V_{i}-\overline{V}\right)^{2} \tag{31}\]  
\[RMSE=\sqrt{MSE} \tag{32}\]  
\[MAE=\frac{1}{N}\sum_{i=1}^{N}\left|V_{i}-\overline{V}\right| \tag{33}\]  
where \(U\) and \(V\) are the observed value of features and dataset class; the number of observations is denoted as \(N\); \(U_{i}\) and \(V_{i}\) are the observed value of features and dataset class at \(i^{th}\) observation, and \(\overline{U}\) and \(\overline{V}\) are the mean value of \(U\) and \(V\), respectively. Equations (34)-(37) represent the recall, accuracy, F1-score, and precision of the classification measures. \[Accuracy=\frac{TP+TN}{TN+TP+FN+FP}\times 100 \tag{34}\]  
\[Precision=\frac{TP}{TP+FP}\times 100 \tag{35}\]  
Figure 5: Flowchart for LFSOA-based hyperparameter optimization.