## 2 Proposed Method
### Improved Dual-Stage Two-Phase Model Based on Attention Mechanism
#### 2.2.2 Models  
The encoder adopts the two-phase attention mechanism, aiming to learn the spatial correlation among the central site collection exogenous series, its matching sites' exogenous series and target series. Specifically, the spatial correlation of central site collection and matching site exogenous series can be studied in the first phase attention. In the second phase attention, the weighted features are studied again, that is, the spatial correlation among the exogenous series of the central site collection, its target series and matching sites' target series. Therefore, the two-phase spatial mechanism ensures that the learned spatial correlation is stable. The decoder is a temporal attention mechanism, which aims to learn the temporal correlation among the encoder hidden state, central site collection target series and matching sites' target series. Because target and non-target have a certain influence on response selection [26], a two-phase attention mechanism is used to learn the correlation between the target series and the exogenous series in the paper. The flow chart of the improved dual-stage two-phase model based on the attention mechanism is shown in Figure 3.  
Figure 3: Flow chart of improved dual-stage two-phase model based on attention mechanism. (1) First phase attention  
In the first phase, DSTP-RNN used the attention module to learn the spatial correlations between these exogenous attributes but all of these exogenous attributes come from the same site, the influence of exogenous series of other sites on the exogenous series of the central site is ignored. Because of the influence of wind, air pollutants from other sites will diffuse to the central site collection, resulting in the change of the exogenous series. To deal with this problem, in this paper, the data of the central site's collection and its matching site is input into the model together, and the exogenous series relationship between them can be studied through the model, which can improve the accuracy of predicting PM\({}_{2.5}\) concentration for the central site. The matching site is determined by exogenous series correlation method, and the formulas are as follows:  
\[corr^{k}=r(x^{k},y) \tag{11}\]  
\[\lambda^{k}=\frac{\exp(corr^{k})}{\sum\limits_{j=1}^{n}\exp(corr^{k})} \tag{12}\]  
\[f(i)=\sum\limits_{k=1}^{n}\lambda^{k}r(x^{k},x^{(i)}_{k}) \tag{13}\]  
\[f(best)=\max(f(j)),1\leqslant j\leqslant N, \tag{14}\]  
where \(r(\cdot)\) is the Pearson correlation coefficient, \(corr^{k}\) is the Pearson correlation coefficient of the \(k\)-th exogenous series of the site and the target series. \(f(i)\) is the correlation between the exogenous series of the current site and the corresponding exogenous series of the \(i\)-th site and \(f(best)\) is the best selected matching site. Given the \(k\)-th feature \(x^{k}\) of the central site collection at time \(t\), the \(k\)-th feature \(x^{(best)}_{k}\) of the best matching site exogenous series. The input attention mechanism-I is used to learn the exogenous attributes' spatial correlation of the central site collection and the matching site:  
\[f^{k}_{t}=v^{T}_{f}\tanh(W_{f}[h^{f}_{t-1}:s^{f}_{t-1}]+U_{f}x^{k}+M_{f}x^{( best)}_{k}), \tag{15}\]  
where \([*:*]\) is concatenation operation, and \(v_{f}\in R^{T},W_{f}\in R^{T\times 2m},U_{f},M_{f}\in R^{T\times T}\) are the parameters to learn. \(h^{f}_{t-1}\in R^{m}\) and \(s^{f}_{t-1}\in R^{m}\) are the hidden state and the cell state of the encoder LSTM0 (LSTM layer in the first attention module) unit at the previous moment, respectively. \(m\) is the hidden size in the first attention module.