# An Unsupervised Learning Approach for Analyzing Unsafe Pilot Operations Based on Flight Data
## 3 Methodology
### Data Preprocessing and Feature Selection  
In the QAR dataset, the sampling frequency varies from 1 to 8 Hz with respect to different parameters. Table 1 shows 31 commonly used QAR parameters and their sampling frequencies. For airlines, they can use QAR data to find abnormalities in pilot operations, engine conditions, and aircraft performance in time. For researchers, QAR data can be used to investigate safety events to ensure aviation safety. In this paper, the QAR dataset is processed in the following way. First, all original data need to be uniformly scaled, i.e., features with small values are scaled up while those with large values are scaled down, so that the contributions of different features to the final results are roughly equal. Next, by consulting with flight experts, including experienced pilots, QAR data decoding experts, and airline managers, we choose the following parameters as the basic features: wind speed (_WIN_SPD_ parameter), wind direction (_WIN_DIR_), height (_RADIO_LH_) (RADIO_LH and RADIO_RH show very similar values, so we only use one of them), the magnetic heading (_HEAD_MAG_) of aircraft, and pitch angle (_PITCH_). Then, these basic features are further processed based on prior knowledge and expert experience. From flight expert experience, we know that the pitch angle of an aircraft is largely impacted by the headwind it encounters. However, because the headwind is not included in the original flight parameters, we should combine the aircraft's magnetic heading (i.e., the flying direction of the aircraft relative to the north), wind speed, and wind direction to calculate the effect of headwind on the aircraft, as shown in Figure 3. We mainly use \begin{table}
\begin{tabular}{c c c c} \hline \hline
**No.** & **Parameter** & **Description** & **Frequency (Hz)** \\ \hline
1 & ALT\_QNH & Altitude & 1 \\
2 & ALT\_STD & Standard altitude corrected & 1 \\
3 & RADIO\_LH & Left radio height & 4 \\
4 & RADIO\_RH & Right radio height & 4 \\
5 & LDCI & Left landing gear state & 4 \\
6 & LDGR & Right landing gear state & 4 \\
7 & LDGNOS & Nose landing gear state & 4 \\
8 & IAS & Indicated airspeed & 1 \\
9 & VAPP & Landing reference speed & 1 \\
10 & GS & Ground speed & 1 \\
11 & VRTG & Vertical acceleration & 8 \\
12 & IVV & Vertical speed & 1 \\
13 & PITCH & Pitch angle & 4 \\
14 & PITCH\_CPT & Captain pitch control & 8 \\
15 & PITCH\_FO & Deputy captain pitch control & 8 \\
16 & GW & Aircraft gross weight & 1 \\
17 & ROLL & Roll angel & 2 \\
18 & ROLL\_CPT & Captain roll control & 8 \\
19 & ROLL\_FO & Deputy captain roll control & 8 \\
20 & HEAD\_MAG & Magnetic heading direction & 1 \\
21 & WIN\_DIR & Wind direction & 1 \\
22 & WIN\_SPD & Wind speed & 1 \\
23 & RUDD & Rudder position & 2 \\
24 & N11 & Engine 1 speed ratio & 1 \\
25 & N12 & Engine 2 speed ratio & 1 \\
26 & TLA1 & Throtle lever 1 position & 1 \\
27 & TLA2 & Throtle lever 2 position & 1 \\
28 & FLAP\_PL & Left flap actual angle & 1 \\
29 & FLAP\_PR & Right flap actual angle & 1 \\
30 & DME1 & DME 1 distance & 1 \\
31 & DME2 & DME 2 distance & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Description of commonly used QAR parameters. the longitudinal component of the wind as our feature, and the calculation formulas are as follows:  
\[\theta=\alpha-\beta \tag{1}\]  
\[WIN_{alg}=WIN_{spd}\times\cos\theta \tag{2}\]  
where \(\alpha\) represents the wind direction, and \(beta\) represents the magnetic heading of aircraft, so \(\theta=\alpha-\beta\) represents the wind direction relative to the aircraft. \(WIN_{spd}\) denotes the absolute wind speed, so the longitudinal component of the wind speed with respect to the aircraft is represented by \(WIN_{alg}\). On the other hand, the aircraft pitch control is also closely related to how long the pitch angle keeps changing in the same direction (increasing or decreasing) and how far it has gone.