# A Framework for the Detection of Search and Rescue Patterns Using Shapelet Classification
## 3 Proposed Methodology
### Generation of Synthetic Datasets  
The limitations in annotated vessel trajectory data makes the application of supervised machine learning techniques really difficult [25]. However, the generation of synthetic trajectories can be a solution for the cases that the movement patterns are well defined, as is the case of SAR maneuvers. In this work, we developed a trajectory generator that is able to produce realistic AIS datasets that contain SAR maneuvers, with a certain amount of noise and random movements. For the moment, the trajectory generator produces values only for the features that are essential for the trajectory classification process. More specifically, it generates trajectories that contain the following 6 features:  
1. Timestamp: It is used for the temporal ordering of the trajectory points.
2. Latitude: The vessel's latitude at that timestamp.
3. Longitude: The vessel's longitude at that timestamp.
4. Bearing: The vessel's bearing (i.e., the angle in degrees between North and the vessel's course) at the same moment. It's important to state that bearing, is more preferred than heading, which demonstrates the direction that the vessel is pointing and changes more frequently.
5. Speed: The actual vessel speed over ground in knots.
6. Distance: The distance covered since the previous position reported by the AIS.  
The last two features have not been used in our experiments but will be integrated into future versions of the classifier.  
The trajectory generator has several parameters that allow to generate trajectories with less or more noise at bearing, speed and sampling frequency, in order to better simulate real datasets. The starting timestamp has been arbitrary set to be 1 February 2015 12:00:00 and the starting longitude and latitude values are set to be in the center of the Aegean sea, in Greece. However, any values can be used in place.  
The trajectory generator can produce datasets with information about SAR patterns and random trajectories. The SAR patterns that are supported comprise: (i) Step up, (ii) Spiral movement, (iii) Expanding square, (iv) Creeping line, (v) Sector. These patterns are composed from the following simple vessel movements:  
* Left turn: A left (anti-clockwise) turn is defined as a change (subtraction) in the vessel's bearing by a desired number of degrees. The default value is 90 degrees.
* Right turn: A right (clockwise) turn is defined as the addition of a number of degrees to the current vessel's bearing. The default value is 90 degrees.
* U-turn: A u-turn is the subtraction of 180 degrees from the current vessel's bearing.
* Straight-forward: This refers to a vessel that continues its course with no change in its bearing.  
The resulting bearing values at any moment are expressed in degrees and cannot be lesser than 0 degrees and greater than 360 degrees. These four movements are combined in a specific order in order to synthesize the respective maneuver and are repeated depending on a given loop value. The loop value represents the times that this kind of movement must be performed. If it's mentioned otherwise, the loop value is a random integer between 2 to 6 (in the experiments, values 2, 3, 4 have a higher probability). Every simple movement can have speed, frequency and bearing noise. Limits for these kind of noise are \(\pm\)2-60 m/s, \(\pm\)3-15 min, \(\pm\)0-3 degrees respectively. Figure 4 presents an example of the resulting synthetic pattern for an expanding square maneuver (left) and the respective plot for the bearing (right).