The model is inspired by the work of text summarization [1]}, where paragraphs of similar topics are grouped and summarized. Thus we propose to first group the original trajectories using the Sort-Tile-Recursive (STR) algorithm [2]}. STR is originally used to group spatial data for the bulk-loading construction of R-tree. We use it to group the trajectories so that the trajectories within the same group already have certain spatial and temporal proximity. Then we feed each group of trajectories independently into an attention-based encoder. The idea behind is to encourage closer trajectories to learn more similar representations from each other. Then we use an encoder-decoder structure to reconstruct the input trajectories, and use a decoder-encoder structure to learn the similarity between the input trajectories, as we will show in Section REF . The similarity is computed between the mean encodings of the first encoder and the intermediate encodings of the second encoder. As we use global attentions to produce the encoding and a mean operation to aggregate a group of encodings, we call our model ATTN-MEAN Autoencoder. Once we obtain the trajectory encodings using the trained model, we use DBSCAN (as always used in literature [3]}, [4]}) to cluster the encodings. The corresponding trajectories in the same cluster are therefore considered as traveling companions.
