## 3 Methodology
### The Proposed Metaheuristic-Based Feature and Hyperparameter Optimization
#### 3.4.2 HSMO Optimizer  
The SMO is a population-based optimization technique that contains six stages to complete its work. The algorithm operates by dividing the population into groups to search for food and exploring different regions of the solution space, with at least two population sizes in each group. During an iteration process, a sequence of local and global steps is performed to update the solution thoroughly. The local steps take into account only the group population solution when updating individual solution, and the global steps are performed by considering the best solution among all the groups. The sequence is fixed twice in each iteration because the solutions are altered through both the local groups as well as the global leader until the optimum solution is achieved. The fission-fusion behavior helps the algorithm to explore the search space and to find the optimal solution. Initialization phase:  
A population of spider monkeys is randomly distributed. For the parameter N and population P, we had P solutions (monkey/point), where each solution \(SMi(i=1,2,\dots,P)\) contained N parameters, \(je\{1,2,\dots N\}\). The parameters were then given as input to the objective function resulting in a fitness value that represents the quality or performance of the solution. The initialized population of spider monkeys is now ready for the subsequent optimization phases of the SMO algorithm. \[SM_{ij}=SMmin_{j}+R(0,\ 1)\times\big{(}SMmax_{j}-SMmin_{j}\ \big{)} \tag{9}\]  
Equation (9) represents the calculation of the parameter value \(SM_{ij}\) for the \(i^{th}\) spider monkey and the \(j^{th}\) parameter (dimension). The lower and upper bounds in the j direction are denoted as \(SMmin_{j}\) and \(SMmax_{j}\), respectively, while \(R(0,\ 1)\) is a random value generated within a predefined range. Local Leader Phase:  
In the local leader phase of the SMO algorithm, the monkeys within each group explored the search space by updating their positions. This was achieved by randomly selecting a subset of dimensions for each monkey and perturbing their positions in those dimensions using random weights. If the new position led to an improved fitness value compared to the old one, then the new position of the current spider monkey was updated using Equation (10), Otherwise, the current element remained unchanged. After this process was completed for all randomly selected monkeys within the group, the local leader phases end. \[SMnew_{ij}=SM_{ij}+R(0,\ 1)\times\left(LLk_{j}-SM_{ij}\ \right)+R(-1,\ 1)\times \left(SM_{rj}-SM_{ij}\ \right) \tag{10}\]  
where \(SM_{newij}\) is the \(i^{th}\) monkey's positions in \(j^{th}\) dimension, \(SM_{ij}\) is its current position, \(LLk_{j}\) represents the \(j^{th}\) dimension of local leader of the kth group, and \(SM_{rj}\) is the \(j^{th}\) dimension of a randomly selected \(SM\) from the kth group, such that \(r\
eq i\). Here, \(R(0,\ 1)\) and \(R(-1,\ 1)\) represent random values. From Equation (10), monkeys always take parameter weights from the local leader in addition to a random group member from the population, and because the local leader usually has a better solution in its group, it gives direction for improving the solution. This process encourages an exploration of the search space. Global Leader Phase:  
In this phase, each monkey drifts towards global leader. If any group of monkeys consist of G members, then within that group G-1 updates will be made. However, unlike the previous phase, for the selected monkey to update, one more parameter of that monkey is marked for updating instead of the whole set of parameters. This action helps in selecting the best parameters. In this phase, each spider monkey updates its position using a combination of its own persistence, knowledge of the global leader position, and experience of neighboring spider monkeys. The position update equation is given by Equation (11).