# Grid-Based Vessel Deviation from Route Identification with Unsupervised Learning
## 3 Module Design
### Dataset and Data Stream  
The data used for the task includes all received AIS messages for the region of the southwestern coast of Portugal, over a period of three years, from June 2017 to June 2020. Each line corresponds to a single AIS message, sent by a vessel at a given date and time. The following columns are present:  
* Message type: Integer between 1 and 27, which represents the type of message sent. The most common is message type 1, Scheduled Position Report, which accounts for approximately 82.4% of the data. Following this, messages of type 3, Special Position Report, response to interrogation, accounting for 10.4% of data. Messages of type 18, Standard Position Report for class B shipborne mobile equipment, account for 7.2% of data. The remaining messages as a whole account for under 0.1% of the data. * Repeat: Indicator if the message is repeated. Messages with a repeat equal to one should hold the same information as the first message sent. * MMSI: Unique vessel identifier. * Status: Vessel navigational status, depicted in Figure 2a. The values range between 0 and 15, 15 being the default value \"Undefined\", which represents the second-most common vessel status, accounting for 21.4% of the dataset. The most represented category is messages of type 0, Under Way Using Engine, around 56% of the dataset. Statuses 7 Engaged in Fishing and 5 Moored correspond to approximately 15.8% and 5.5% respectively. All other statuses correspond to the remaining 1.4% of data. * Turn: Denotes the number of degrees and the direction of turning of a vessel. It ranges between \(-128\) and 127, corresponding negative values to counterclockwise turns and positive values to clockwise turns. The value \(-128\) is a special value, used when no turning information is available from the vessel, which in our case corresponds to 54.38% of data. Around 32.64% of vessels reported a rate of turn of 0\({}^{\circ}\), 1.15% with rates of turn less than or equal to 3\({}^{\circ}\) to the left or the right ([\(-\)3,3]). 4.77% and 4.46% of vessels reported rates of turn between 3\({}^{\circ}\) and 63\({}^{\circ}\) to the left and right respectively. Finally, 1.33% and 1.24% of vessels reported rates of turn of exactly 127 degrees left and right. A summary of this data can be observed in Figure 2b. * Speed: Speed over ground (SOG) of the vessel. A total of 99.9% of the registered data is between 0 and 25 knots, the distribution of which we can see in Figure 2c. Approximately 63% of the remaining 0.1% of data is at exactly 102.3 knots, which leads us to believe this to be an error code. * Accuracy: Defines the position precision, low (default) when the sensor's precision is over 10 m, accounting for 34% of the data and high (66% of data) when the precision is less than or equal to 10 m.
* Longitude: Reported vessel longitude. * Latitude: Reported vessel latitude. * Course: Course over ground (COG), which represents the degrees of navigation in relation to the geographic north (true north), Figure 1(d). The value 511 is used as Not Available. In Figure 1(d), we can observe the course distribution in the dataset. The sum of the reported courses equal to 0\({}^{\circ}\) corresponds to 4.65% of the dataset. We can also observe very high representation in the dataset around the angles of 110\({}^{\circ}\), 280\({}^{\circ}\), and 340\({}^{\circ}\), with smaller peaks in the angles 130, 310, and 270. The values 360 and above are various error codes, with 360 considered \"Undefined\" by European standards. All values over 359 are assumed to be errors. * Heading: Represents the degrees of navigation in relation to the magnetic North, as seen in Figure 1(f). The value 511 is used as (Not Available). In Figure 1(e) we can observe that 57.5% of the messages do not include Heading information. * Second: Information about the second in the minute on which the message was broadcast. This value is an integer between 0 and 63, where the values 60 to 63 represent (Unavailable) timestamps and other error codes.