# Prediction of Flight Delays at _Beijing_ Capital International Airport Based on Ensemble Methods
## 5 Results and Discussion
### Predicting Results  
To enhance the performance of the model, the parameters of each algorithm were determined by the grid-search method. If the result of a certain algorithm was not unique, we ran it ten times to obtain the average of the performance metrics. To avoid overfitting, we used five-fold cross-validation on the original training set. All algorithms were im \begin{table}
\begin{tabular}{c c} \hline \hline
**Air Route** & **Similarity Coefficient** \\ \hline PEK–HGH & 1.00 \\ PEK–YHW & 0.93 \\ PEK–NKG & 0.82 \\ PEK–CZX & 0.81 \\ PEK–HYN & 0.75 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Similarity coefficients of the top five air routes. plemented using Python 3.9 on a computer with an octa-core 3.2-GHz CPU and 16-GB random-access memory. From the six regression models, the four models with optimal performance indicators were selected as base learners. After testing, we chose SVR as a meta-learner. Table 7 shows the prediction performance based on the test dataset. The results confirm that stacking method outperformed the other five baseline methods and achieved high-performance predictions based on high-dimensional data. Figure 10 shows the distribution of error values for the predictions with the observed values. The error values increased with the growth of the observed values. When the observed values were larger than 60 min, the prediction error started to increase, implying a decrease in accuracy. It was found that 95.7% of the predicted values were within 35 min deviation from the observed values, implying an acceptable prediction performance. Figure 11 shows the results of predictions at \(\tau=2\) and \(\tau=3\), that is, predicted 2 h and 3 h ahead. When \(\tau=3\), the prediction error increased, but stacking method continued to outperform the other methods. \begin{table}
\begin{tabular}{c c c c c c c c} \hline  & **Stacking** & **SVR** & **LGBM** & **RF** & **AdaBoost** & **KNN** & **LR** \\ \hline MAE & 12.58 & 13.3 & 13.51 & 14.05 & 14.56 & 15.11 & 15.78 \\ RMSE & 22.97 & 23.59 & 23.82 & 24.50 & 24.62 & 25.01 & 26.16 \\ \hline \end{tabular}
\end{table} 
Table 7: Predictive performance based on the test dataset. Figure 10: Distribution of the prediction error values and the observed values. The predictions for different airlines were stable in view of the small gap in MAE values of the nine airlines. As shown in Figure 12, there was no strong correlation between MAE and the number of flights, indicating that the model was robust for different airlines regardless of their numbers of flight records. Four scenarios with different explanatory variables were set to validate the novel variables proposed in this paper. As Table 8 shows, S0 is the initial scenario, including flight attributes, weather, and periodic data. S1 and S2 are the scenarios after the addition of arrival pressure and cruise pressure, respectively. S3 is the set of all explanatory variables. The results show that the arrival pressure and cruise pressure were very important for improving model performance. We encoded the periodic data with one-hot encoding and sine-cosine functions, and input the data into the model for prediction. The performance comparison of different encoding methods of periodic data is shown in Table 9. It was found that the prediction model achieved better performance with sine-cosine function encoding than one-hot encoding of periodic data. This method was better able to interpret the periodic explanatory variables. The method not only improved performance, but was also interpretable.