# Aircraft Track Anomaly Detection Based on MOD-Bi-LSTM
## 2 Algorithm Description
### MOD for Track Deviation Detection  
In anomaly detection, Local Outlier Factors (LOF) can not only solve the problem of anomaly detection with inconsistent local density [30] well, but also measure the position anomaly reflected by Euclidean distance well. For multidimensional target track data, LOF is not able to measure the position, speed and heading anomaly of the target for different requirements. Therefore, the MOD based on Dynamic Time Warping (DTW) algorithm can be the anomaly measurement of a multidimensional track. MOD can not only measure the position anomaly of the target, but also measure the height, speed and heading anomaly of the target, simultaneously. Track data generally is multidimensional sequences comprised of multidimensional data points. In civic air traffic monitoring and processing systems, track data usually includes multidimensional characteristics such as the batch number, attribute, category, quantity, model, aircraft number, time, longitude, dimension, altitude, speed and heading of the target. Tracks can be expressed in following sets:  
\[TD=\{TR_{1},TR_{2},\ldots,TR_{i},\ldots,TR_{n}\} \tag{1}\]  
where: \(TD\) is the track set, \(i\in[1,n]\) is the track number and \(n\) is the total number of tracks; the track \(TR_{i}\) is a multidimensional track point sequence composed of several multidimensional track points in time sequence:  
\[TR_{i}=\left\{P_{i1},P_{i2},P_{ij},P_{im}\right\} \tag{2}\]  
where: \(P_{ij}\) stands for the \(j\)th multidimensional track point in the \(i\)th track, \(j\in[1,m]\) for the number of track points, and \(m\) for the total number of track points. For different tracks \(TR_{i}\), \(m\) is not necessarily the same. \(P_{ij}\) for the track point is a vector with multidimensional characteristics, i.e., the target number, attribute, type, time, longitude, dimension, height, speed and heading of the \(j\)th multidimensional track point in the \(i\)th track. The DTW similarity function as the distance measurement replaces the traditional Euclidean distance to evaluate the distance between sequences to solve the problem that it is difficult to accurately calculate the distance between time series by using the Euclidean distance. The principle of DTW algorithm is to give the two sequences, \(TR_{A}=\{TR_{A1},TR_{A2},\ldots,TR_{Ai},\ldots,TR_{An}\}\) and \(TR_{B}=\{TR_{B1},TR_{B2},\ldots,TR_{Bj},\ldots,TR_{Bm}\}\), whose lengths are n and m. A matrix grid of n*m is constructed, with Euclidean distance \(D\) as the standard and matrix elements \((i,j)\) as the distance \(D\big{(}TR_{Ai},TR_{Bj}\big{)}\) between the point \(TR_{Ai}\) and the point \(TR_{Bj}\). The matrix angle at the beginning of the sequence is the boundary condition, satisfying the constraints of continuity and monotony. The path with the smallest accumulative distance calculated by dynamic programming is the best path. At this point, the accumulative distance value of the best path is the DTW similarity of the two sequences. When calculating the DTW distance between the two tracks, only position characteristics are considered instead of the dynamic characteristics such as speed, heading and acceleration in terms of the Euclidean distance between the two points. The multi-factor directional DTW distance \(\delta_{M}\) of the track \(TR_{A}\) and the track \(TR_{B}\) is defined by the multi-factor distance \(mfdist(P_{a},P_{b})\) between two points. Considering the position, velocity, heading and acceleration features between the two vector points, the multi-factor distance between them is defined as follows:  
\[\begin{array}{l}mfdist(P_{a},P_{b})=w_{d}*dist(P_{a},P_{b})+w_{v}*dist(v_{P_ {a}},v_{P_{b}})+w_{\theta}*\\ \text{ \istics. The weight factor satisfies the formulation: \(w_{d}\geq 0,w_{v}\geq 0,w_{b}\geq 0,w_{\alpha}\geq 0\), and \(w_{d}+w_{v}+w_{\theta}+w_{a}=1\). In the anomaly detection of multidimensional tracks, the values of four feature weights can be determined proportionally according to the needs of different detection tasks.