Context-Sensitive Prediction of Vessel Behavior

: Research in the ﬁeld of maritime anomaly detection and vessel behavior prediction primarily focuses on developing methods for extracting typical vessel movement patterns from historical tra ﬃ c data. However, contextual information is currently not considered during pattern extraction by existing research. Combining contextual information with historical tra ﬃ c data has the potential to produce both more accurate tra ﬃ c patterns and more precise predictions of vessel behavior. This paper investigates the beneﬁt of incorporating contextual information during the extraction of vessel behavior and the prediction of the most probable vessel behavior. A method is presented that combines historical vessel tra ﬃ c data with information about the course of waterways. Typical behavior patterns are extracted by applying kernel density estimation, which are subsequently used for predicting the most probable vessel behavior. Using this approach, we were able to predict in which area the vessel is most likely to sail, as well as the actual track for a sailing time of 2:35 h. Additional potential applications of our approach can be derived from the results, which, in addition to behavior prediction, can also be used to detect anomalous vessel behavior.


Introduction
Surveilling the world's oceans is a challenging task due to the fact that around 71 percent of the earth's surface is covered by water. In 2019, around 11 billion tons of goods were shipped with vessels on one of the seven seas, making the seas the most important way of transportation in today's globalized world. This number is expected to increase in the next few years until 2024 with an annual growth of maritime trade of 3.4 percent [1]. Such a growth yields a further increase in traffic volume, making it even more challenging to surveil the sea area.
Vessel Traffic Service (VTS) officers have a key role in this context. Besides assisting the ship crew with navigation, their main task is to continuously monitor the sea area from ashore in order to identify suspicious vessel behavior. The early identification of potential ship-to-ship encounters is one of the most important goals of VTS officers. For their surveillance task, VTS officers can rely on data from different sources. Radar information is used, as well as data from the Automatic Identification System (AIS) [2].
AIS is a well-established self-reporting system for vessels and is mandatory for all vessels with gross tonnage above 300, as well as for vessels carrying more than 50 passengers. The information broadcast via AIS is separated into three types: general information about a vessel like its name, dimensions, or the unique nine-digit identifier Maritime Mobile Service Identity (MMSI) distributed by static messages. All information related to the current voyage of a vessel is included in voyage related messages. This includes the destination of the journey, draught, or the Estimated Time of Arrival (ETA). Dynamic messages contain information about a vessel's current navigational status, which includes the current position, speed, and course. Static and voyage related AIS messages are broadcast every six minutes, whereas the broadcast frequency of dynamic AIS messages depends on the vessel's speed and rate of turn [3,4].
Especially in traffic-intensive areas, support will be necessary to prevent human beings from a cognitive overload. These traffic-intensive areas are mainly situated in coastal areas, where the traffic is structured by waterways [5] in order to reduce the workload of both navigators and VTS officers. Collisions often have severe effects on the environment, so that especially in these traffic-intensive areas, the navigators have to be supported to detect potential hazardous ship-to-ship encounters as early as possible. Predicting future vessel movements provides the possibility to detect potentially dangerous vessel encounters as early as possible. Early detection enables taking appropriate measures to ensure the safety of humans, the environment, and machinery.
In this paper, we present an approach to predict the behavior of vessels in waterways. We combine historical AIS data with topological information about the waterway to extract typical traffic patterns. Furthermore, we model the typical traffic patterns using the Probability Density Function (PDF). By calculating the expected value for the course, speed, and relative position within the waterway, we predict the most probable vessel behavior. We furthermore propose to evaluate vessel prediction methods depending on their later application. In this paper, we assume that our method will be used for collision avoidance; hence, we present an evaluation method that applies the Fujii ship domain in order to compare the predicted track with the actual historical track. This enables us to make a statement about the accuracy of our results. We evaluate our prediction method by using historical AIS data and the information of the waterway of the Elbe River.
The remainder of the paper is structured as follows: We continue with an overview of existing research and present our research questions. We then discuss why contextual information should be considered. In this section, we define the term "context" applied to this paper. We proceed by describing our approach to traffic pattern extraction and the prediction method used for vessel behavior. Afterwards, we describe our evaluation and conclude the paper with a discussion.

Related Work
In order to support humans during sea area surveillance and in collision avoidance, the research fields of maritime anomaly detection and vessel behavior prediction have emerged. Both research fields are strongly connected, since they share a common approach. The first step is to extract typical vessel behavior by applying statistical methods and Big Data techniques to a set of historical AIS data [6,7]. Following this, the extracted typical vessel behavior is used to detect anomalous behavior automatically from a new set of AIS data [6]. For the purpose of behavior prediction, the typical vessel behavior is used to predict the future track [7].
Methods in the research field of anomaly detection have the goal to support VTS officers during sea area surveillance in order to automatically detect suspicious vessel behavior that might be a threat to the environment or result in a hazardous ship-to-ship encounter. Riveiro et al. [6] explained that there is a variety of existing anomalies in the maritime domain, which makes it difficult to create a thorough taxonomy. Finally, the considered anomaly depends on the considered features during the extraction process, which has also an impact on how normal behavior is represented [6].
In order to detect anomalous vessel maneuvers, Lamm and Hahn [8] presented an approach for extracting maneuvering points from historical vessel tracks. In this case, the authors used Fossen's definition of a maneuver, which describes a maneuver as the changes in course or speed [9]. As a result, the authors created a maneuver net. A maneuver net is a topological graph in which the nodes are the identified maneuvers, and the edges represent the connection between each maneuver. To identify a maneuver, the authors applied the Cumulated Sum (CUSUM) procedure. CUSUM detects changes in measurements (here course) as soon as a defined threshold is exceeded. The appropriate decision function also provides the time of detection. After all maneuvering points in a set of given historical vessel tracks are detected, the authors applied the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) [10] algorithm, which clusters maneuvers location-wise. In order to create a maneuver net, it is necessary to extract the core of each cluster. Lamm and Hahn [8] applied the medoid calculation process for each cluster for this purpose.
A statistical approach for extracting traffic patterns was presented by Ristic et al. [11]. In this approach, traffic patterns are modeled as areas in which vessels usually sail. For this purpose, the authors applied adaptive Kernel Density Estimation (KDE). In general, KDE is used for data smoothing, which aims at approximating a function from a sample that models the most important features of this sample. To be more precise, KDE is a non-parametric method for estimating the unknown underlying probability function of a sample [12]. The approach is tested with real incoming AIS data in which the authors detected anomalies based on the extracted sailing areas of vessels.
To detect anomalies in vessel motion, Ristic [13] created square grid cells in the considered sea area. Each vessel is represented by a state vector, consisting of the position and its velocity. The behavior of a vessel is then described as a Poisson point process for each square grid cell. With the help of this representation, the authors demonstrated how to detect anomalies in the motion of vessels.
Laxhammar et al. [14] compared KDE with the Gaussian mixture model for detecting anomalous vessel behavior. They modeled vessel behavior as a four-dimensional space consisting of the position of a vessel (latitude and longitude), as well as the velocity of a vessel (also in latitudinal and longitudinal directions). With this approach, the authors detected positional anomalies, i.e., vessels sailing in unusual areas.
Research conducted in the field of behavior prediction aims at creating methods for predicting the future behavior of vessels as accurately as possible. As mentioned above, behavior prediction can be used to forecast the development of the current traffic situation and thus automatically detect vessels behaving anomalously as early as possible [15]. In collision avoidance, behavior prediction methods can be used to reduce the number of false and implausible collision alarms on board vessels, as shown in [16].
Daranda [17] presented an approach for predicting the most probable behavior of vessels in the Baltic Sea by training an Artificial Neural Network (ANN). For training purposes, the authors extracted so-called turning points from historical AIS data. A turning point is defined as the point at which vessels perform a course change of at least four degrees. The ANN was trained to predict the sequence of turning points of vessels in the Baltic Sea.
Similar to the approach presented by Daranda [17], Zissis et al. [18] trained an ANN for predicting the most probable vessel behavior in the Ionian Sea. The ANN was trained with information about the last four position of a vessel in order to predict the future position in 15 min.
By applying a particle filter, Mazzarella et al. [15] predicted the future track of a vessel. The main idea of their approach is to associate the current track of a vessel with historical tracks. After the association was done, they predicted the future behavior of a vessel by calculating the mean values for course and speed of the matching historical track.
The Traffic Route Extraction and Anomaly Detection (TREAD) framework presented by Pallotta et al. [19] is an approach for unsupervised extraction of typical vessel traffic patterns from AIS data. TREAD enables the identification of distinctive points in historical vessel tracks like entry, exit, and stationary points (e.g., ports). For this purpose, Pallotta et al. [19] applied the DBSCAN algorithm. They identified typical patterns by extracting the sequence in which vessels travel between the obtained points.
In a subsequent work, Pallotta et al. [20] used the work presented in [19] for pattern extraction. To predict the future movement of a vessel, the authors proposed associating the current vessel track with the extracted historical traffic patterns. The result of this association was assumed to be the prediction, which was modelled as an Ornstein-Uhlenbeck process. With this modelling approach, the uncertainty of vessel movement due to the different vessel hydrodynamics can be represented in the prediction result.
A rule-based approach for predicting vessel behavior in waterways was presented in [21]. In this work, the authors extracted typical tracks from historical AIS data. For predicting the future behavior of vessels, the authors associated the typical tracks with the current track and selected the most similar track based on vessel attributes like dimensions (e.g., length and draught), position, course, and speed. According to their rule, the most similar historical track was assumed to be the prediction for the future vessel behavior.
Bomberger et al. [22] presented a grid-based method for predicting vessel behavior in coastal areas. For this purpose, the authors applied a unified grid over the port area of Miami. The authors described vessel behavior within each cell by the speed and course of the vessels within the respective cells. However, a discretization of these parameters was proposed to map the speed of the vessels in the cells to slow/medium/fast. Similarly, they applied the same to the course so that it was described by east, west, south, and north. To learn the movement patterns, the authors used Neural Associative Incremental Learning (NAIL), which allowed them to learn a corresponding state for each cell the vessel visits by means of the discretized parameters speed and course. Using NAIL, the authors predicted the cell in which the vessel will be located in 15 min.

Context-Sensitive Pattern Extraction and Prediction
As shown above, the most prevailing works in both research fields focus on historical AIS data for pattern extraction [6,23]. Due to this, the quality and thus usability of the extracted traffic patterns essentially depend on the data basis, their quality, and their completeness. For example, extracted traffic patterns may not cover the entire area navigable by vessels. If such patterns are subsequently used for anomaly detection, false alarms might be generated. At the same time, this limits the solution space for vessel behavior prediction. Basically, these problems can be addressed by using more data, assuming that this increases the solution space. Alternatively, additional information can be considered, and the AIS data can be combined with it. This way, the potential solution space can be extended, which in turn allows better behavior prediction and anomaly detection. Especially in coastal areas where waterways regulate traffic, additional information about the local environment can help to improve the accuracy of traffic patterns. At the same time, any errors or outliers from the AIS data used can be detected more easily and treated properly.
In addition, there is the fundamental question of how to assess the prediction performance. In order to measure the quality of the prediction, the prediction error was calculated in the work described above. This error results from the comparison of the prediction with the actual vessel behavior. Depending on the prediction result, either individual points are compared with each other [18,21] or the entire error is described as a function of time [15,17,20]. However, a classification of the prediction errors is missing in the considered publications, although this is important for a later practical application of the methods. Depending on the field in which this method is applied to predict the behavior of vessels, different requirements are demanded on the quality of the prediction results. For the prediction of the probable traffic density of a waterway, it is less important to predict the course of ship tracks as precisely as possible. Instead, it is rather important to be able to predict how many ships will be on the waterway at any given time. However, if, in contrast, the prediction method is used to assess collision risks, it is essential to be able to predict the geographical course of vessel tracks as accurately as possible.
From this argumentation, we derive the research questions for this work: • How can the most probable vessel behavior be predicted by using typical traffic patterns? • How can these typical traffic patterns be extracted? • How can the quality of the prediction be assessed?
We address this problem by presenting a context-sensitive method for predicting the most probable vessel behavior in traffic-intensive areas with waterways in this paper. Our main idea is to combine historical AIS data with information about the course of waterways, which gives us vessel patterns that are related to the course of the waterway. As described above, the existing methods exclusively use AIS data to extract typical vessel pattern movement. Hence, this is one contribution of this work.
We apply Kernel Density Estimation (KDE) during the extraction of typical vessel behavior patterns. The application of KDE for modeling typical behavior patterns has already been successfully demonstrated in existing work [11,14,15]. Therefore, we use this method in our approach. Furthermore, KDE allows us to derive a continuous density function from a (discrete) sample. To evaluate and demonstrate our method, we predict the behavior of vessels throughout the Elbe River.
At the end, we measure the performance of our prediction method by calculating the distance between the predicted vessel track and the actual historical vessel track, as well as applying the Fujii ship domain. The proposal of an application related evaluation method is the second contribution of this work.
The remainder of this section is organized as follows: We give a brief motivation for why it is necessary to incorporate additional information about the context in which typical vessel behavior patterns are extracted. We proceed with a description of our approach to extract context-sensitive vessel behavior and how this information is used for behavior prediction.

The Potential of Context Information
The route of a vessel is substantially influenced by its environment. Especially important are all the information that reflects the topology of the sea area. This includes water depths, land masses, and the course of waterways that vessels are obliged to follow to navigate safely. In the following, we refer to all this information that describes the topology of the sea area as the context of vessel behavior. Hence, vessel behavior is always a reaction to its context. The incorporation of context in the extraction of typical traffic patterns for behavior prediction and anomaly detection has the potential to address the weaknesses of existing research and thus contribute to the extraction of more precise traffic patterns.
As described above, the most prevailing research in the fields of maritime anomaly detection and vessel behavior prediction uses exclusively AIS data to extract typical vessel movement patterns. With our method, we provide a first approach for incorporating contextual information about the course of waterways during vessel pattern extraction and behavior prediction. To explain the advantage of considering contextual information when extracting traffic patterns, we take the approach of Lamm and Hahn [8] and discuss the added value of considering contextual information. In their work, Lamm and Hahn [8] proposed to describe vessel behavior as a sequence of maneuvers. For this purpose, they used the CUSUM algorithm to identify the maneuvering points in historical vessel tracks and clustered these maneuvering points into a graph. The resulting maneuver net can be used for the detection of anomalous vessel maneuvers [8], as well as for the prediction of vessel behavior. However, this method can yield implausible prediction results, which can be explained by the fact that the medoid calculation is used to generate the graph from the clusters. Since these clusters are density based, they can vary greatly in shape and size. Due to this, the medoid can be located at the border of the cluster. This affects the geographical path of the edges, because the edges simply connect the maneuvering points. Consequently, it is possible that the final maneuver net may not adequately reflect the topology of the sea area and the contained waterways. This impacts the accuracy of the behavior prediction of the vessels along the edges.
This disadvantage becomes clear if a simple approach to behavior prediction is applied. Such an approach is based on two rules: First, the vessels perform maneuvers at the maneuvering points of the maneuver net. Thus, the sequence of maneuvering points can be predicted. Second, it is assumed that the ships follow the geographical path of the edges between the maneuvering points. However, if the geographical path of the edges does not reflect the topology of the sea area, the predicted track may be outside the designated waterway, pass through shallow waters, or be on the wrong side of a waterway. If such a prediction is used, for example to detect future critical ship encounters in a VTS, the VTS officers will receive implausible and false alarms.
As defined above, the context of vessel behavior is the set of all information related to the topology of the sea area. The consideration of the context can help to address the problem just shown. For example, the consideration of land masses can help to identify invalid edges. Furthermore, the course of the waterway can give an indication of where vessels are most likely to sail along. Thus, the area in which the vessels are likely to sail can be limited. With the help of contextual information, the extracted traffic patterns can be defined more precisely than, for instance, with a graph-based approach.

Extraction of Context-Sensitive Vessel Behavior
In general, waterways are marked on both sides by lateral buoys, as defined by the International Association of Lighthouse Authorities (IALA), and they have primarily two functions: They indicate safe navigable water for vessels in which a minimum depth is guaranteed at all times. Second, waterways are used to structure traffic in dense traffic areas in order to reduce the risk for collisions. When vessels approach a port, they must have the green buoys on their right side, and vice versa, the red buoys have to be on their right side. At the same time, navigators are required to keep their vessel as far to the right as possible within the waterway [5].
We use these rules of conduct for navigation within waterways to characterize the most probable behavior of vessels more precisely. The underlying assumption is that the distance between vessels and the edge of the waterway remains constant as long as they sail within the waterway. Only in curves may the distance change, depending on how the vessel follows the curve. Furthermore, we assume that vessels of the same type and a similar dimension have a similar behavior. Due to this, the following procedure must be carried out for different vessel types with respect to their dimensions. In order to discretize the area of waterways during behavior pattern extraction, we divide the waterways into a grid, with four buoys always forming a cell. This procedure is shown in Figure 1. As one can see, the waterway is marked with green (bs 1 , . . . bs n ) and red (bp 1 , . . . bp n ) buoys. Thus, this implies that cell C n consists of the buoys bp n , bp n+1 , bs 1 , and bs n+1 . In addition to this, we distinguish the sailing direction for vessels inside each cell and determine for each cell the area in which vessels typically sail. To provide precise predictions, we assume these areas to contain 90 percent of the vessels sailing in each cell per direction. Thus, we calculate the 90th percentile based on all vessel tracks for each cell and direction. In Figure 1, this is depicted by the blue and purple rectangles.
The next step is to extract the most probable vessel behavior for each cell per sailing direction, which is depicted in Figure 2. At the beginning, we divide the waterway into a grid with the principles presented above. Each cell is again divided into two sub-cells, depending on the sailing direction of the vessels. For each cell per sailing direction, we calculate the most probable vessel behavior. In our work, we define vessel behavior by using the parameters Course Over Ground (COG), Speed Over Ground (SOG), and distance on the starboard side to the edge of the waterway (d starboard ) of a vessel. We assume, that the historical AIS data used allow us to derive the underlying Probability Density Function (PDF) for each parameter. To extract the PDF, we apply KDE. By applying KDE, we can approximate a continuous process of the respective parameters based on the discrete dataset. This enables us to address the first research question of this paper. By modeling ship behavior patterns using a PDF, we are able to make a conclusion about the most probable behavior. Hence, the KDE is used to extract typical vessel behavior patterns. Calculating the expected value of the PDF for the parameters COG, SOG, and d starboard results in the most probable vessel behavior.
With the procedure described above, we have presented an approach to describe the typical motion of vessels in a waterway. Thus, the context-sensitive behavior pattern in this work describes the behavior of vessels in relation to the waterway in which they sail.

Context-Sensitive Vessel Behavior Prediction
In the previous section, we described our approach to extract typical ship behavior. As a result, we obtain the expected value for the parameters COG, SOG, and d starboard , which thus model the most probable behavior of the ships within each cell. For our prediction, we assume that vessels of the same type and having similar dimensions have a similar behavior. Furthermore, we divide the prediction problem into several small problems, which means that we predict the behavior of the ships in each cell individually and combine these predictions to obtain an overall prediction for a passage through the entire waterway. The prediction procedure is explained using Figure 3.
At the beginning, (a) it is determined in which cell the ship is located (here, cell C1). With the help of the course (COG) the direction of the ship is determined. Next, the track of the ship within cell C1 is predicted. For this purpose, it is assumed that the ship starts from the current position and moves in the direction of the course, keeping a fixed distance to the edge of the waterway. The prediction is represented by the orange line. Then, (b) is determined based on the direction of the ship and the current cell, and the following cell is determined (here, C2). With our previously presented approach to extract the traffic patterns, we calculate the expected value for the parameters COG, SOG, and d starboard for each cell depending on the sailing direction, which we now use for the prediction of the waterway through cell C2. Thus, we obtain the trajectory relative to the buoys inside cell C2. The prediction result for cell C2 (orange line) is appended to the prediction of cell C1.
This procedure is repeated iteratively (c) until an entire track through the waterway is obtained (d). Since the extracted traffic patterns are valid for the respective cells of the waterway and are used for prediction within each cell, the resulting track is context-sensitive.

Assessing the Prediction Performance
As presented at the beginning of this section, the assessment of predicted vessel behavior must be done in accordance with the application of the prediction method. Hence, the application scope must be defined at the beginning, which enables the selection of an appropriate evaluation method for the prediction performance. In this paper, we evaluate our prediction method in the context of collision avoidance or collision risk assessment. A variety of methods to assess the collision risk exist in the literature. In their survey on existing methods for collision risk assessment, Xu and Wang [24] categorized the existing methods into three groups: First, the traffic flow theory is a statistical approach to characterize the traffic density of sea areas by analyzing, e.g., the encounter probability or the collision risk. Second, ship domains are used to assess the collision risk. The main idea of ship domains is to define an area around a vessel into which no other vessels may enter in order to minimize the collision risk. Depending on the approach considered, the areas around the vessels differ in their shape and division. Finally, the methods of the Closest Point of Approach (CPA) and time to CPA (tCPA) calculation are mentioned. Here, the vessel movements are approximated as linear vectors, with the help of which, the CPA and tCPA are then calculated, which in turn enables conclusions to be drawn about the collision risk [24].
To assess the quality of behavior prediction for a single vessel, the concept of ship domains stands out compared to the other two options. In contrast to the CPA calculation and traffic flow theory, ship domains do not require multiple vessels for evaluating the prediction performance in the context of vessel behavior prediction.
As introduced above, ship domains mark the safe areas around a vessel that must be kept clear in order to be safe. The first and basic approach was presented by Fujii and Tanaka [25]. The authors propose to use an ellipse to mark the safe area around a vessel, the dimensions of which were derived statistically. In general, the dimensions of the ellipse depend on a vessel's length and whether the sea area in which the vessel is currently sailing is the open sea or a narrow channel. Figure 4 depicts this basic concept. All later approaches are based on the idea of Fujii and Tanaka [25], but differ in the derivation of the area and its form. For example, Goodwin [26] considered the Convention on the International Regulations for Preventing Collisions at Sea (COLREGS) and constructed the ship domain accordingly.
In order to assess the prediction performance of our approach in the context of collision risk assessment, our main idea is to create a ship domain based on each predicted ship position and determine the congruence of the predicted ship domain and the actual ship domain based on the actual vessel position. This procedure is illustrated in Figure 5.
On the leftmost side, the predicted vessel track consisting of two positions is depicted. We then construct a ship domain according to Fujii's [25] concept. This is shown in the middle of Figure 5. After this step, we create a ship domain around the corresponding to the predicted ship position and compare both ship domains, which is shown on the rightmost side of Figure 5. To assess the prediction quality, we compute the area in which both ship domains intersect each other (red area in Figure 5). The result will be a percentagewise representation of the intersection.
The question of the interpretability of this value will arise in the subsequent course of this paper. We will discuss this question from the perspective of collision risk assessment. In principle, a congruence of less than 100 percent means that the ship domain is smaller, which implies that not all potentially critical situations can be detected. At the same time, a smaller congruence means that all detections in the smaller concurring domain are generally to be considered more critical. Thus, the following basic consideration logically applies. The higher the match between the predicted and actual ship domain, the more suitable the prediction method is for assessing the collision risk.

Evaluation
To evaluate our method, we use a set of historical AIS data and additional information about the waterways. Furthermore, we select the historical vessel tracks randomly at a ratio of 70/30, with 70 percent of the tracks being used to create the directional corridors and 30 percent unseen data for the subsequent behavior prediction. This allows us to make a conclusion about the generality of the procedure.

Dataset
For the evaluation of our concept, we use historical AIS and sea chart data from the Elbe River. The Elbe River is Germany's most important shipping route, along which the two seaports of Cuxhaven and Hamburg are located. In addition, all ships that pass through the Kiel Canal also pass through the Elbe. The AIS data we use were recorded by stations located in Brunsbüttel, Cuxhaven, and Wilhelmshaven [27], which are able to cover the German Bight.
We select the data from the two-month period from August to mid-October 2018, where we consider vessels with a length of 120 to 400 m and restrict the vessel type to general cargo. This complies with the recommendation of Mascaro et al. [28] to group vessels based on their type and length to consider the differences in their hydrodynamic capabilities. Furthermore, we only consider tracks that lead completely through the Elbe River to test our prediction performance. Table 1 summarizes the data we use.  Figure 6 depicts the plotted vessel tracks. All purple data points are tracks that are heading eastward. The blue data points are the westward tracks. Figure 6.
Coverage of the German Bight by the AIS stations in Brunsbüttel, Cuxhaven, and Wilhelmshaven. The black polygon highlights the Elbe River as the study area for this work.
Since we plan to evaluate our prediction process by calculating the congruence of the predicted and actual Fujii ship domain, the length and width of a vessel are the decisive parameters for this. Table 2 gives an overview of the length and width distribution of the vessels in our dataset. The longest vessel in our dataset is 399 m long, whereas the shortest has a length of 123 m. On average, the vessels have a length of 240.64 m with a standard deviation of 83.08 m. Considering the width of the vessels, the widest one is 60 m, and the narrowest vessel has a beam of 16 m. We measured a standard deviation of 10.71 m for the width of vessels with an average beam of 34.65 m. As one can see, our data contain middle to big general cargo vessels that are travelling in the Elbe River.

Context-Sensitive Pattern Extraction
The first step is to divide the waterway in the Elbe River into a grid, following the principles for this procedure explained above. Figure 5 shows an excerpt of the resulting grid for the Elbe River This illustration shows a characteristic of our concept. Cells in the grid are not uniform, but differ from one another depending on the course of the waterway. This can be seen in Figure 7 shortly after the curve. There, one cell at the eastern end is much narrower.
Using 70 percent of the data described in Table 1, the next step is to determine the typical sailing direction for each cell per direction, which is called the directional corridor. As explained above, each directional corridor covers 90 percent of the traffic in a cell per direction. When examining the obtained directional corridors for each cell, we noticed that there are two typical patterns here. Figure 8 shows one pattern where there is a clear separation between the sailing directions. The corridors overlap only partially.  The second pattern is shown in Figure 9. Here, a part of the data points is also shown, which will be used to determine the PDF in the following. It can be clearly seen that the two directional corridors overlap very strongly. This is mainly found in those areas of the Elbe where larger ports are located, such as in Cuxhaven, or, as shown in Figure 9, in front of the lock of Brunsbüttel. The subsequent step is the calculation of the PDF by applying KDE for the parameters COG, SOG, and d starboard for each directional corridor in our grid. In the following, we show exemplary results from the cell and the directional corridors depicted in Figure 9. Figure 10 shows the histogram and the resulting PDF for COG from this cell.
We distinguish between vessels heading eastbound or westbound. From Figure 10, it can be seen nicely that if vessels sail eastbound, they mainly have a course between 80 and 100 degrees, whereas westbound sailing vessels have a course between approximately 260 and 280 degrees. In both distributions, minor outliers can be identified.  Figure 11 depicts the SOG distribution for both sailing directions in the same cell. In general, when looking at the figures, it becomes clear that the distribution of speed for vessels sailing west is wider than that for ships sailing east. If sailing eastbound, vessels most probably have a speed between eight and 10 knots. However, if sailing westbound, vessels are in general faster compared to vessels sailing eastbound with a speed between 10 and 12 knots. The last parameter we use to characterize the behavior of vessels in waterways is the starboard distance of a vessel to the edge of the waterway. Figure 12 depicts the distribution. Since the inspected cell has an overall width of 885 m, we expect the distribution to be between zero and 450 m, which is approximately the middle of the waterway. As one can see, the majority of the vessels sailing eastbound have a starboard distance to the edge of the waterway of approximately 200 and 400 m, which meets this expectation. However, a local maximum can be observed with a peak of approximately 550 m. At the same time, a similar distribution can be observed for vessels heading westwards. Here, the majority of the vessels are approximately between 150 and 350 m away from the edge of the waterway. A local maximum, located at around 480 m, can also be observed in this distribution. After this step, the remaining 30 percent of the data is used for further evaluation. We check whether the 90th percentile also applies to these data. Figure 13 clearly shows that the remaining 30 percent of the tracks are also within the previously calculated directional corridors. With 92.31 percent, this number is slightly higher as the previously calculated 90 percent. Thus, 7.96 percent of the tracks are outside the directional corridors.

Prediction Performance
In order to assess the prediction performance, we first check whether the historical track is inside or outside the directional corridor. If the historical track is outside, we calculate the distance between the track and the corridor. However, if the historical track is inside the corridor, we assume the distance to be zero.
Next, we calculate the distance between the predicted track and the actual historical track. This procedure is illustrated in Figure 14.
Here, an example cell from the waterway grid can be seen. The directional corridors are the blue and purple rectangles, and the dotted lines inside each corridor are the predicted track. As introduced above, the first step is to check whether both historical tracks are within the appropriate corridors. Each track consists of numbered circles. In Figure 14, a part of the red track is outside the blue corridor. Thus, the distance between the track points 5-8 and the blue rectangle is calculated. Afterwards, the distance between each of the numbered track points and the predicted track is calculated. We extend this point-based comparison to an area-based one. Starting from the predicted position and taking into account the vessel's length and width, we create a polygon that represents the vessel. Next, we calculate the percentagewise congruence of the area of the directional corridor with the area of the vessel polygon.
The second area-based comparison was already described above. It involves the area-based comparison of the predicted and actual ship domain.
In addition to this, we compute the difference between the predicted and actual course and speed in each directional corridor. Finally, we compute the Root Mean Squared Error (RMSE), average, median, and standard deviation for these values. The results, provided in Table 3, refer to the prediction of vessel tracks through the Elbe River with an average sailing time of 2:35 h. By applying the method above to predict a vessel track through the Elbe River, we can observe an average distance between the prediction and the actual track of around 67.75 m. The median is lower at 55.70 m, indicating that there are high outliers. However, the accuracy of the geographical prediction oscillates quite highly with a standard deviation of 52.66 m. We furthermore determined the prediction error with 85.99 m for the 2:35 h long journey through the Elbe River.
For the distance between the predicted track and the directional corridor, an error of around 10.98 m is determined. However, the average distance and the median here are even lower with 3.02 and 0.16 m. The results contain a standard deviation of around 10.42 m.
The next step is the comparison between the predicted COG and the actual COG of the voyage. Here, an error of around 12.51 degrees is observed. The average and median in this context are quite similar, 8.64 and 5.44 degrees, which leads to the assumptions that there are no bigger outliers. However, a quite high standard deviation can also be observed for the COG prediction.
Predicting a vessel's speed for its voyage through the Elbe River yields a difference from the actual SOG of 2.58 knots on average. The median is even lower at 1.54 knots with a standard deviation of around 2.19 knots. By predicting the speed of the vessel, we achieve an error of around 3.24 knots.
Our prediction method also includes a prediction of the distance to the starboard side of the waterway of a vessel. Compared with the actual track, our method predicts this distance with an error of 88.49 m for the journey through the entire Elbe River. Here, we determine an average distance of 68.94 m, which is higher than the median of 56.20 m. A high standard deviation in this distance can be observed with 55.14 m, which is almost equivalent to the median.
The area-based comparison yields an average overlapping of the directional corridors with a vessel polygon of around 81.93 percent and an even higher median of around 89.91 percent. Compared to those two values, there is a relatively small standard deviation of around 20.07 percent.
In order to assess the prediction performance in the context of collision risk assessment, we calculate the percentagewise overlapping of the predicted ship domain with the actual ship domain. Both ship domains overlap 65.81 percent. Similar to the previous area-based comparison, the median is slightly higher at around 68.50 percent. A standard deviation of around 22.67 percent can be observed.

Discussion
After considering the results in the previous section, the concept of using directional corridors in particular seems to be a promising approach to behavior prediction. We applied this concept to predict vessel track with an average sailing time of around 2:35 h through the Elbe River. The small values for the distance between the historical vessel tracks and the appropriate directional corridors indicate that the majority of vessels sail within the directional corridors and that only a few outliers can be observed. The standard deviation of around 10.42 m supports this. Ultimately, this also means that 7.69 percent of the vessels outside the directional corridors observed above sail very close to the corridor boundaries. Considering the average width of the vessels in the data used of approximately 34.64 m, the distance of 3.02 m on average, as well as the error of 10.98 m are rather negligible.
The results also show that the prediction of speed performs well with this approach. Here, an average error of about 3.24 knots can be noted. Considering that variations in the real measurements caused by the sea conditions can certainly be found here, this error is acceptable. However, the situation is different when it comes to predicting the course. The variations in the prediction result of the course indicate that courses in the data per cell are more scattered than the speeds. Ultimately, this method provides a good first approximation to a course prediction.
An interesting aspect is the classification of the evaluation results from the perspective of collision risk assessment. With our prediction method, we achieve a median correspondence with the actual ship domain of about 68.50 percent. In other words, our predicted ship domain covers only about two-thirds of the area of the actual ship domain. Thus, if our method is used to make a collision risk assessment of the situation at sea in the future, all situations detected with the ship domain would be classified as critical. Since the area is also reduced here, the time remaining to perform an evasive maneuver would also be reduced.
At the beginning of this paper, we raised the following two research questions: • How can the most probable vessel behavior be predicted by using typical traffic patterns? • How can these typical traffic patterns be extracted? • How can the quality of the prediction be assessed?
Based on the presented results, we can answer all the research questions. We use knowledge about the course of waterways and the corresponding buoys as additional information. Before this information can be combined with the AIS data, a pre-processing is necessary. By dividing the waterways into a grid, it is possible to describe each AIS data point in terms of its position within the grid. Afterwards, it is possible to extract typical behavior patterns in a cell, which results in context sensitive vessel behavior. As a result, we get directional corridors in which we approximate the vessel behavior stochastically by applying KDE. By determining the expected value for each parameter that we use to characterize the behavior, we can give an estimate of the most likely behavior of the vessels in each cell of the grid. By sequencing the adjacent cells, we can predict the most probable behavior along the waterway. We outlined above why it is necessary to evaluate a method for predicting vessel behavior in the context of its future application. In this paper, we evaluated our approach in the context of collision risk assessment using the concept of ship domains. This allows a classification of the prediction errors as opposed to only a consideration of the deviations.
However, the concept of directional corridors presented in this work has potential for improvements. One aspect here is the chosen form of representation of the directional corridors. Currently, our grid consists of cells with buoys at their corners. For simplification, we assume in our concept that these cells are always rectangles from a geometrical point of view. We defined that there are two directional corridors per cell, which are also rectangles and cover 90 percent of the traffic in the respective direction of sailing. However, this has the disadvantage that the course of the waterways could be modelled imprecisely. Especially the modelling of the directional corridors within sharp curves does not reflect the real course of the waterways sufficiently. Another example are junctions or forks, for example in the Elbe River near Brunsbüttel. For vessels sailing upstream the Elbe River, the waterway is divided, with one waterway leading further towards Hamburg and the other towards the lock in the direction of the Kiel Canal. With our current approach, it is not yet possible to model junctions and forks and to use them accordingly for predicting behavior.
A different method for generating and modelling the directional corridors could help to solve this problem. One possibility is the use of the QuickHull algorithm [29], which can form a convex hull from a set of points. By using a convex hull as a directional corridor, the course of traffic can be described more precisely. This is also a first approach to model junctions and forks.
As described above, the median deviation between predicted track and historical track is approximately 55.70 m. One explanation for this deviation is the prediction method used, which ultimately consists of the rule of using the expected value for prediction. Figure 15 shows a predicted track in comparison to the actual track. The right image shows the framed section of the left image in detail. As seen in the figure, what can be effective for a single directional corridor is not always appropriate for behavior prediction beyond several corridors, because this prediction method ignores the previous behavior. This explains the zigzag pattern in the prediction. Hence, for improving the prediction result, this would be the starting point: A prediction method has to be designed that takes the previous behavior into account and makes a prediction on this basis.
Our experiment indicates the great potential of the directional corridor concept for behavior prediction. However, our approach is not only limited to vessel behavior prediction. Especially the concept of the directional corridors has remarkable potential to be used for maritime anomaly detection.
Here, positional anomalies, as well as anomalies regarding vessel speed and course can be detected with this concept. In general, positional anomalies are generated by vessels that sail outside the typical sailing area of vessels. With our concept, it is possible to distinguish between two levels of positional anomalies: whereas a Level 1 positional anomaly is generated by vessels that sail outside the calculated directional corridors, vessels sailing outside the grid and therefore outside of the waterway generate a Level 2 positional anomaly. Based on the expected values for course and speed and the corresponding standard deviations, it is possible to detect vessels that sail too fast, too slow, or have an atypical course. When applied in a VTS, this concept can help to decrease the workload for VTS officers and thus increase the overall safety at sea.

Conclusions
In this paper, we presented a method for the context-sensitive prediction of vessel behavior in waterways. For this purpose, we presented a concept with which we discretized the area of the waterway. This includes the creation of a grid, whose cells consist of four buoys of the waterway each. Within each cell, we calculate the most probable behavior based on the historical AIS data and use it for prediction. Here, our approach has the great advantage that the topology of the waterway is considered by incorporating the buoys. The interpretation and application of the resulting traffic patterns can therefore be done with great accuracy with respect to the actual conditions of the sea area. At the same time, the danger of inaccurate or invalid traffic patterns can be minimized, as can happen when using DBSCAN in a heterogeneous sea area. Furthermore, we emphasize the need to evaluate methods of behavior prediction according to their later application. Following this argumentation, we demonstrated how to evaluate methods for behavior prediction in the context of collision avoidance. For this purpose, we applied a classical method from risk assessment, the Fujii domain. With the help of this evaluation procedure, it was feasible to make an estimation about the future applicability of our prediction method for collision avoidance.
Although the results presented here provide the first promising indications of the applicability of our concept, the results can be improved by using a different prediction approach. Currently, we predict vessel behavior independently of the behavior in the previous corridor, which can lead to great variations for each of the considered parameters. A first starting point here is the consideration of the previous behavior in the previous cells.
Another idea to enhance the prediction performance is to consider weather information. Here, our idea is to combine historical AIS data with information about the prevailing weather conditions and then extract weather dependent traffic patterns.