## 4 Routes Knowledge Exploitation
### Route Prediction  
When observing a sequence of state vectors for a vessel of a given type, \(c\), the route classification assigns a probability to each compatible route, based on the posterior probability (4) that the vessel belongs to that route. In other words, given the latest state vector sequence for a vessel and a time window, \(\Delta_{t}\), the future position of the vessel, both in a single and multi-step mode, can be predicted following Algorithm 4. Assuming that no anomalies will be observed for the vessels of interest, the route prediction is essentially applying context-based tracking algorithms. In other words, the mean velocity direction together with the series of route points provided by previous vessels represent a set of constraints that can be used to efficiently predict future vessels positions, based on static stored information, such as the vessel type. In this case, the inference is driven by the learned route codebook and by the top most probable routes computed using Equation (6). Figure 12 shows an example of route  
Figure 11: Estimation of transition probabilities: Empirical (solid blue line) and fitted Weibull-like (dashed red line) distributions of the distances, \(\Delta_{p}\), in nautical miles between the predicted and actual positions of vessels in the North Adriatic Sea Area analyzed in Figure 3. The time lag, \(\Delta_{t}\), ranges from five to 60 minutes, with an increment of five minutes. The figure shows how to derive the transition probability, \(P(\mathbf{s}_{t}|\mathbf{s}_{t-1},R_{c}^{k})\), from the distance between the new observation, \([x_{t},y_{t}]\), and the predicted position, \([\hat{x}_{t},\hat{y}_{t}]\), given the \(R_{c}^{k}\) and the previous observation, \([x_{t-1},y_{t-1}]\). This gives a measure of match between the route and the observed state sequence. prediction. In Figure 12a, a given vessel enters the scene in the right-bottom corner and is monitored in three subsequent time frames, \(T_{1}\), \(T_{2}\) and \(T_{3}\). In each time frame, a track segment of the five most recent state vectors is observed. Based on these five observed values, the methodology is able to provide a probabilistic prediction of the vessel final position after a given amount of time, using the historical contextual information. For the considered vessel, there are initially five compatible routes: the reported percentages represent the probability that the vessel is expected to move along each route based on the route classification process. In Figure 12b, seven hours ahead from the latest observation, the predicted positions, obtained following Algorithm 4, are shown, together with the associated probabilities, computed as in Section 4.1. In Figure 12c, we see that in the next time frame (three hours afterward), the probabilities are updated to reflect the reduced number of destination options. Figure 12: Vessel destination prediction given the set of compatible routes (**a**) at three different time-frames (**b**, **c** and **d**). The probability of vessel location is computed based on Equation (6) and conditioned to the distribution of vessel types within each route. It can be seen that the extracted routes provide enough information to consistently predict the vessel position hours ahead, even in relatively complex routing systems. Figure 13 exemplifies such a sequential analysis. The monitored scene is in front of the Port of Livorno, in the Ligurian Sea area. A vessel shows an anomalous behavior, which is correctly detected by the proposed methodology. The vessel initially moves westward, in accordance with the motion pattern of the compatible route, resulting from the classification. The compatible historical route is shown with gray arrows. While the vessel sails the area, the probability of its state vector is sequentially updated based on Equation (6). The trajectory of the vessel is represented with a sequence of arrows whose head marker color depends on the incremental posterior probability calculated with a given-width backward time window.