## 2 Materials and Methods
### Measuring Similarity Between Ship Trajectories
\(\left(\text{F}_{i},\text{F}_{j}\right)\) represent all possible joint distributions of F\({}_{1}\) and F\({}_{j}\), and d\(\left(\text{x},\text{y}\right)\) represent the distance between x and y. This distance measures the correlation between two distributions and determines the distance at which the expected value is the smallest. DTW  
Measuring the distances between trajectories requires trajectories of fixed length, which does not usually occur because the observation interval is flexible. DTW is used to compare signals of unequal length by finding time warping that minimizes the total distance between matching points and is expressed as Equation (4) [28]. \[\text{D}_{\text{DTW}}\left(F_{i},F_{j}\right)=\frac{\left(d_{\text{DTW}}\left( F_{i},F_{j}\right)+d_{\text{DTW}}\left(F_{i},F_{j}\right)\right)}{2} \tag{4}\]  
F\({}_{i}\), F\({}_{j}\): Two trajectories for comparison. In Equation (5), \(\phi_{i}\) and \(\phi_{i}\) are time distortion functions that minimize the distance between aligned points, m\({}_{t}\) is the trajectory weight coefficient, and M\({}_{\phi}\) is the trajectory normalization factor. The distortion trajectory \(\phi\) can be found efficiently using dynamic programming. \[D_{\text{DTW}}\left(F_{i},\text{ }F_{j}\right)=\frac{1}{T_{i}}\sum_{t=1}^{T_{i}}d_ {E}\left(\phi_{i,t},\text{ }\phi_{j,t}\right)m_{t}/M_{\phi} \tag{5}\]  
F\({}_{i}\), F\({}_{j}\): Two trajectories for comparison; T\({}_{i}\): Length of F\({}_{i}\), m\({}_{t}\): trajectory weight coefficient, M\({}_{\phi}\): trajectory normalization factor  
LCSS  
LCSS is another alignment tool for trajectory data of unequal length; however, it is more robust to noise and outliers than DTW because it does not require all data points to match. Unfair bias can be prevented by ignoring cases where point-to-point mapping does not match properly. The distance proposed in LCSS is defined in Equation (6) [29]. \[\text{D}_{\text{LCSS}}\left(F_{i},F_{j}\right)=1-\frac{LCSS\left(F_{i},F_{j} \right)}{\min\left(T_{i},T_{j}\right)} \tag{6}\]  
F\({}_{i}\), F\({}_{j}\): Two trajectories for comparison. The \(\text{LCSS}\left(\text{F}_{i},F_{j}\right)\) value specifies the number of matching points between two trajectories. \(\left\{t_{1},f_{2},\cdots,f_{t}\right\}\) represents all vectors of trajectory F up to time t.  
The methods used to measure the similarity between ship trajectories in this paper can be summarized as follows: MHD is a metric used to quantify the similarity between two trajectories by considering their spatial distance. It is particularly useful in trajectory analysis because it captures the maximum deviation between two sets of points. WSD is a metric that quantifies the similarity between two probability distributions. In the context of trajectory similarity, it treats trajectories as distributions of points in space and time, measuring how much \"effort\" is required to transform one trajectory into another. DTW is a robust algorithm used to measure the similarity between two trajectories when their speeds or phases differ. The similarity between trajectory points is typically measured using Euclidean distance. LCSS is a method used to measure the similarity between two sequences (or trajectories) by identifying the longest common subsequence present in both. It resists noise and allows for slight deviations between trajectories, offering more flexibility than other metrics, such as Euclidean distance.