# A Short-Term Forecast Model of foF2 Based on Elman Neural Network
## 2 Model Principle
### Improved Particle Optimization Algorithm
#### 2.2.2 Improvement of Particle Swarm Optimization  
Particle swarm optimization has a fast convergence speed. However, the similarity between the particles is high at the later stage of training, which makes the training of the model easy to fall into local optimum. Therefore, the following improvements have been made to the particle swarm optimization algorithm in this paper:  
1. Using local averages instead of global averages can make training more difficult to fall into local minimum but take more time [13]. Therefore, this paper combines two methods. Suppose each particle has s neighbors, the \(s+1\) particles are represented as \(\{\textbf{P}_{1},\textbf{P}_{2},\cdots\textbf{P}_{s+1}\}\). The average position of these \(s+1\) particles is:  
\[\textbf{P}_{a}=\sum_{i=1}^{s+1}\frac{\textbf{P}_{1}}{s+1} \tag{8}\]  
Then, the speed update formula of the particle swarm algorithm becomes:  
\[\textbf{V}_{i}(m+1)\ =\ \omega\textbf{V}_{i}(m)+c_{1}r(\textbf{P}_{\text{best} }-\textbf{P}_{1}(m))+c_{2}r(\textbf{G}_{\text{best}}-\textbf{P}_{i}(m))+c_{3} r\omega_{1}(\textbf{P}_{ia}-\textbf{P}_{1}(m)) \tag{9}\]  
where \(c_{3}\) is the non-negative acceleration constants, \(\omega_{1}\) is the weight coefficient of \(\textbf{P}_{ia}\). Here, we make \(c_{3}\)= 0.2, and:  
\[\omega_{1}(m)\ =\ 1-0.8m/m_{\text{max}} \tag{10}\]  
where \(m_{\text{max}}\) is the maximum number of iterations. In this paper, we set this value to 300.  
2. At the later stage of training, all particles are sorted according to their fitness function values and re-initialized the lower-ranking particles, if the global optimum particle has not changed or changed little after many iterations. In this paper, all particles are sorted if the function fitness of \(\textbf{G}_{\text{best}}\) decreases by less than 0.1 MHz after 40 iterations. Then, the last 25% of the particles are initialized and the initialization range is set to [-3,3] to ensure the diversity of particles.  
3. Data Settings and Model Construction  
3.1. Setting of Training Data  
For an effective prediction of foF2, the ionosphere data of Wuhan Station from 2008 to 2013 is used to train the model. The ionosphere data inevitably contain gaps due to ionosphere disturbances. If the data for the previous hour and the next hour are both present, linear interpolation is used to complete the missing data. Otherwise, the data is discarded. Details of the input parameters are described below.  
3.1.1. Diurnal and Seasonal Variation  
Due to the influence of the earth's rotation and revolution, the ionosphere has obvious diurnal and seasonal variations, which makes foF2 have the same variation. Hour number (HR) from 0 to 23 and day number (DN) from 1 to 365 are used to describe diurnal and seasonal variations, respectively. In order to avoid unrealistic numerical discontinuity, HR and DN are converted to quadrature components:  
\[HRS\ =\ \sin\left[\frac{2\pi\times HR}{24}\right] \tag{11}\]  
\[HRC\ =\ \cos\left[\frac{2\pi\times HR}{24}\right] \tag{12}\]  
\[DNS\ =\ \sin\left[\frac{2\pi\times DN}{365}\right] \tag{13}\]  
\[DNC\ =\ \cos\left[\frac{2\pi\times DN}{365}\right] \tag{14}\]