## 3 Background and Methods
### Yield Prediction
#### 3.2.2 LFSOA-Based Hyperparameter Tuning for BILSTM  
Using the LFSOA, the hyperparameters of BILSTM were optimized to provide a reliable crop yield forecast that helped to avoid the overfitting issue. The SOA was converted into the LFSOA by incorporating the Levy flight, which was used to avoid premature convergence. LF is a mechanism for random walk that utilizes a long-tailed distribution of distances for dispersion. This results in a high probability of short jumps and a low probability of large jumps during the random walk. Levy flight is used to supplement the SOA model as an examination of the SOA model shows that the model is prone to reducing the diversity of search agents in the early stages of the attack phase of the model. This results in a weaker exploration ability of the model. The inclusion of Levy flight allows for the inclusion of greater randomness within the model. The lowest and maximum settings of Max-Epoch, L2 Regularization, Dropout, and Learning Rate were used to initialize the solutions in this LFSOA. The ranges for L2 Regularization, Dropout, and Learning Rate were \([0.003,0.1]\), \([0.1,0.4]\) and \([0.003,\ 0.1]\), respectively, while the options for Max-Epochs were \([5,\ 10,\ 15,\ 20]\). To determine the ideal set of hyperparameters, the LFSOA was fed these randomly produced solutions. The random walk mechanism was provided by the LF which led to achieving the appropriate control over the local search. Therefore, the LFSOA was used with an effective local search to optimize the hyperparameters. The conventional SOA [34] is a modern swarm optimization approach that mimics the migration and attacking behavior of seagulls. This migration is said to be a seasonal behavior of seagulls that move to different locations in search of a wide variety of food that would provide them with enough energy. This process is displayed as follows:  
* Migration is initialized by moving a seagull swarm. Initial locations are dissimilar from each other to avoid collisions. * The gulls use their collective knowledge to their advantage, traveling in the direction of maximum survival to obtain the lowest possible cost. In general, seagulls attack birds traveling over the sea, using a spiral pattern in their attack process. The overall process of SOA is explained as follows. Exploration (Migration)  
The mathematical equations of migration and prey attacking are deliberated here. The exploration phase mimics the seagull swarm traveling towards the locations. The following three conditions, such as avoiding collision, moving toward the best neighbor, and near-optimal search agent are required to be satisfied. * Collision avoidance: An extra variable A is defined for eliminating the collision between the neighbor seagulls. This helps to update the new location of certain seagulls (search agent) as per Equation (16). \[\overset{\rightarrow}{P}_{N}=A\times\overset{\rightarrow}{P}_{c}(T),T=0,1,2, \ldots,Max(T)\] (16) where the location which avoids the other search agent is denoted as \(\overset{\rightarrow}{P}_{N}\); the location of the candidate in the current iteration is denoted as \(\overset{\rightarrow}{P}_{c}(T)\); and the search agent's motion action at the search space is defined by using the A expressed in Equation (17). \[A=FC-\left(T\times\left(\frac{FC}{Max(T)}\right)\right)\] (17) where the iteration is denoted as \(T\), and the frequency control of \(A\) in the period \([0,FC]\) is denoted as \(FC\). * Movement towards best neighbor's direction: Following their avoidance of neighboring collisions, the candidates attempt to travel in the direction of the optimal solution, as shown by Equation (18). \[\overset{\rightarrow}{d}_{e}=B\times\left(\overset{\rightarrow}{P}_{b}(T) -\overset{\rightarrow}{P}_{c}(T)\right)\] (18) where the candidate location moves in the direction of the optimum solution \(\overset{\rightarrow}{P}_{b}(T)\) is denoted as \(\overset{\rightarrow}{d}_{e}\). Further, the balance between exploitation and exploration is achieved by using the coefficient B expressed in Equation (19).