# Novel Cuckoo Search-Based Metaheuristic Approach for Deep Learning Prediction of Depression
## 3 Methods Used
### Proposed Method  
The flowchart (Figure 2) provides a visual representation of how the hybrid PSO and CS algorithm works in conjunction with deep learning models to optimize their performance. It shows the steps involved in the optimization process and how the algorithm's parameters can be adjusted to improve the models' accuracy. It illustrates the steps involved in the hybrid PSO and CS algorithm, which includes initializing the swarm, setting up the fitness function, and applying the PSO and CS optimization techniques to search for the optimal model parameters. The hybrid PSO and CS algorithm is a sophisticated optimization approach that synergistically integrates the particle swarm optimization (PSO) and cuckoo search (CS) algorithms. The algorithm operates by generating a group of particles, each of which is given a unique position and velocity that allows them to explore the search space. These particles interact with each other, exchanging information on the best solutions found so far, thereby facilitating a collaborative approach towards identifying the optimal solution. In contrast, the cuckoo search algorithm is inspired by the breeding behavior of cuckoo birds, where a population of nests, representing candidate solutions, is evaluated based on their fitness. To improve the solution quality, some nests are replaced with new solutions generated randomly from the best nests found to date. By merging the strengths of both the PSO and CS algorithms, the hybrid algorithm enhances the overall optimization performance. This can be achieved in different ways, such as using the PSO algorithm to initialize the population and the CS algorithm to perform local search, or using PSO algorithm to update the velocity of the particles and CS algorithm to update their position (Algorithm 1). ```
\(\bullet\) Initialize the PSO algorithm with N particles \(\bullet\) Initialize the CS algorithm with M cuckoo nests \(\bullet\) While stopping criterion is not met do \(\bullet\) // Evaluate fitness of particles and cuckoo s \(\bullet\) \


```
1:\(\text{\small{\it cont}}\). 2:\(\text{\small{\it If the particle's fitness is better than the global best}}\)
3:\(\text{\small{\it update global best}}\)
4:\(\text{\small{\it\bullet}}\) // Update cuckoos using CS algorithm
5:\(\text{\small{\it\bullet}}\)  For each cuckoo in CS:
6:\(\text{\small{\it Choose a random cuckoo from the nest and perform a Levy flight}}\)
7:\(\text{\small{\it 2. }}\)  If the new cuckoo's fitness is better than the old cuckoo's fitness replace the old cuckoo with the new cuckoo
8:\(\text{\small{\it\bullet}}\) // Update PSO particles using information from CS algorithm
9:\(\text{\small{\it\bullet}}\)  For each particle in PSO:
1.\(\text{\small{\it If the particle is in the top k\% of the population}}\)
10:\(\text{\small{\it update the particle's position using the best cuckoo's position}}\)
11:\(\text{\small{\it update the particle's position using the PSO update equation}}\)
12:\(\text{\small{\it\bullet}}\) // Perform PSO search on a subset of cuckoos
13:\(\text{\small{\it\bullet}}\)  Choose a subset of the cuckoo nests
14:\(\text{\small{\it\bullet}}\)  For each chosen cuckoo in the subset:
15:\(\text{\small{\it\bullet}}\)  For each particle in PSO:
16:\(\text{\small{\it If the particle's fitness is better than the chosen cuckoo's fitness}}\)
17:\(\text{\small{\it\bullet}}\)  update the chosen cuckoo's position with the particle's position
18:\(\text{\small{\it\bullet}}\) // Update PSO particles using information from PSO search
19:\(\text{\small{\it\bullet}}\)  For each particle in PSO:
20:\(\text{\small{\it\bullet}}\)  If the particle's fitness is better than its personal best
21:\(\text{\small{\it\bullet}}\)  update personal best
22:\(\text{\small{\it\bullet}}\)  If the particle's fitness is better than the global best
23:\(\text{\small{\it\bullet}}\)  update global best
24:\(\text{\small{\it\bullet}}\)  Update the particle's velocity and position using the PSO update equation
25:end while
```

**Algorithm 1**\(\text{\small{\it cont}}\).