# Rainfall Similarity Search Based on Deep Learning by Using Precipitation Images
## 3 Rainfall Similarity Search Based on NDCG-IPSO
### Image Similarity Search Based on NDCG-IPSO
#### 3.2.2 Parameter Optimization  
The IPSO is proposed to change the inertia weight \(w\), and learning factors \(c_{1}\) and \(c_{2}\) in the original PSO algorithm to adjust the coefficient weights \(\gamma_{1}\), \(\gamma_{2}\), and \(\gamma_{3}\) in Formula (9) to find the optimal weights for precipitation image retrieval. IPSO changes the above three parameters adaptively with the increase in the number of iterations to avoid the algorithm falling into the partial optimal solution. The major improvements in IPSO include:  
* Inertia weight \(w\);  
Parameter \(w\) represents the degree of retention of the particle to the speed of the last iteration, which can adjust the global and local search capabilities of the algorithm. The larger \(w\) takes at the early stage of the iteration, the stronger the particle global search ability is. The smaller \(w\) takes at the later stage of the iteration, the stronger the particle local search ability is. Therefore, IPSO takes the strategy of decreasing the number of iterations \(k\) linearly to balance the global and local search capabilities of particles, where the relationship between \(w\) and the number of iterations \(k\) is represented as follows:  
\[w(k)=w_{max}-(w_{max}-w_{min})*\frac{k_{max}-k}{k_{max}} \tag{13}\]  
where \(w_{max}\) is the initial maximum inertia weight, \(w_{min}\) is the minimum inertia weight when iterating to the maximum algebra, \(k_{max}\) is the maximum number of iterations, and \(w(k)\) is the inertia weight value when iterating for \(k\) times.  
* Learning ratio \(c_{1}\) and \(c_{2}\);  
Parameters \(c_{1}\) and \(c_{2}\) represent the ability of a particle to learn from the individual and the group optimal solution, respectively, and usually take the same value between 0 and 4 based on experience. Moreover, if \(c_{1}\) takes a large value and \(c_{2}\) takes a small value in the early stages of the iteration it can enhance the global search ability of the particles. Meanwhile, if \(c_{1}\) takes a small value and \(c_{2}\) takes a large value in the later stages of the iteration, it can improve the local search ability of particles. Therefore, IPSO improves parameters \(c_{1}\) and \(c_{2}\) with the symmetric linear strategy [27] to optimize the learning ability of individual optimal solutions and group optimal solutions for particles. The improvements in \(c_{1}\) and \(c_{2}\) are presented as follows:  
\[c_{1,begin}=c_{2,end}=c_{mid}\,+\Delta c \tag{14}\]  
\[c_{2,begin}=c_{1,end}=c_{mid}\,-\Delta c \tag{15}\]  
\[c_{1}(k)=c_{1,begin}-\frac{k}{k_{max}}\Big{(}c_{1,begin}-c_{1,end}\Big{)}= c_{mid}\,+\Delta c\Big{(}1-2\frac{k}{k_{max}}\Big{)} \tag{16}\]  
\[c_{2}(k)=c_{2,begin}-\frac{k}{k_{max}}\Big{(}c_{2,end}-c_{2,begin}\Big{)}= c_{mid}\,-\Delta c\Big{(}1-2\frac{k}{k_{max}}\Big{)} \tag{17}\]  
where \(c_{1,begin}\) and \(c_{1,end}\) represent the initial and termination values of \(c_{1}\), so do \(c_{2,begin}\) and \(c_{2,end}\). \(\Delta c\) represents the maximum variable length of \(c_{1}\) and \(c_{2}\); \(c_{mid}\) is the middle value of \(c_{1}\) and \(c_{2}\).