# Construction of Air Quality Level Prediction Model Based on STEPDISC-PCA-BP
## 3 Results and Discussion
### STEPDISC-PCA-BP Model Construction and Performance  
Prin1-prin5 obtained by PCA was used as the input of the BP neural network, and the AQL was used as the output. Since stratified sampling better reflects the overall characteristics of the data [21,22], a total of 1240 groups were selected as the training set and 531 groups as the test set by random independent sampling in the ratio of 7:3 in each level, and the division is shown in Table 7. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Date** & **AQL** & **Prin1** & **Prin2** & **Prin3** & **Prin4** & **Prin5** \\ \hline
1 January 2015 & 2 & 1.324642 & \(-\)1.21233 & 0.624716 & 1.287813 & \(-\)0.47382 \\
2 January 2015 & 3 & 6.04963 & \(-\)0.42106 & 1.733634 & 0.010815 & 0.17862 \\
3 January 2015 & 2 & 3.384212 & \(-\)0.21597 & 1.558986 & \(-\)0.49273 & \(-\)0.23203 \\... & & & & & & \\
11 January 2020 & 3 & 4.196798 & 0.431482 & \(-\)0.63176 & \(-\)0.78609 & \(-\)0.5376 \\
12 January 2020 & 4 & 5.687232 & 1.622739 & \(-\)0.4458 & \(-\)0.91892 & \(-\)0.35238 \\
13 January 2020 & 2 & 1.392678 & \(-\)1.31886 & \(-\)1.09655 & \(-\)0.43905 & \(-\)0.70181 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Principal component score results. Figure 5: Monthly average for prin1 and prin2. The sample data were normalized to the \([-1,1]\) interval before training the network model, and the five-dimensional vectors \((prin1,prin2,prin3,prin4,prin5)^{T}\) of 1240 groups of training samples were used as the five neuron nodes in the input layer. The output variables were AQL, using unique thermal coding, and level 1-level 6 were represented by 100000, 010000, 001000, 000100, 00000010, 00000001, corresponding to the six output layer neuron nodes. The hidden layer contained four neuron nodes. The STEPDISC-PCA-BP model structure is shown in Figure 6.  
The Sigmoid function was used for the hidden layer, the Softmax function was used for the output layer, and the TrainrP function was introduced in the neural network training. The number of training times was set to 1000, the learning rate was 0.05, the network performance function was selected as MSE, and the training objective converged to the minimum error of 0.03. The five-dimensional principal component score vectors of 1240 groups were used as the training set for the simulation training, and the training results are shown in Figure 7, and the training error is shown in Figure 8. From Figures 7 and 8, the observed number of iterations was 372, the training time was 20 s, the training error converged to 0.03, and the training process stopped. The 531 test sets were tested on the trained STEPDISC-PCA-BP, and the confusion matrix output is shown in Table 8. The diagonal line in Table 8 is the number of samples correctly classified into levels for that level, and the non-diagonal line is the number of samples incorrectly classified into levels. The correct rates for each level in descending order were 62% (level 2), 13.9% (level 1), 6.2% (level 3), 1.7% (level 4), 1.1% (level 5), and 0.6% (level 6). Table 7 showed the number of tested data for each level, from which it \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Level** & **Training Set** & **Test Set** & **Total Sample** \\ \hline
1 & 247 & 106 & 353 \\
2 & 804 & 345 & 1149 \\
3 & 119 & 51 & 170 \\
4 & 43 & 18 & 61 \\
5 & 17 & 7 & 24 \\
6 & 10 & 4 & 14 \\ Total & 1240 & 531 & 1771 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Training set and test set division. Figure 6: Structure of STEPDISC-PCA-BP model. The TP, FN, FP, and TN values of the model within each air quality level were calculated according to Table 8. TP indicates the number of current true levels correctly predicted. FN indicates the number of current true levels predicted as other levels. FP indicates the number of other true levels predicted as current levels. TN indicates the number of other true levels correctly predicted.