Applying language modeling to detect anomalies in bus trajectories - CRUZ, Michael Oliveira da (2022)
Discovering anomalous bus trajectories in urban traffic can help transportation agencies to improve their services by providing a better plan to deal with unexpected events such as weather phenomena, detours, or accidents. To help identifying the potential anomaly cause, we can detect anomalous trajectories and also pinpoint where the anomaly is located. However, a big challenge to performing this task is the lack of labeled anomalous trajectory data. The lack of labeled data hinders model evaluation, and the construction of inductive learning approaches. Additionally, previous approaches heavily rely on pre- processing tasks to segment trajectories before detecting the anomaly. This strategy is not only costly but also may lose important information because segments are analyzed individually without considering the relationship between segments. Lastly, only a few strategies in the literature propose online solutions, which restricts their real-time contribution. On this basis, this thesis aims to propose an online approach based on inductive learning to detect anomalous bus trajectories and pinpoint the anomalous segments. To do that, we initially observed that bus trajectories are pre-defined and well-formed, and they include route labels. Based on that, we supposed that a supervised approach could learn to classify those bus trajectories according to the routes and indirectly detect which ones are anomalous. Thus, we propose a multi-class classifier called Spatial-Temporal Outlier Detection as our first solution to detect anomalous trajectories. We use the uncertainty of the classification by applying the entropy function over the class distribution. Although extensive experiments have shown promising results, our first solution cannot pinpoint where the anomalous segments occur. To overcome that restriction, our intuition is that trajectories can be represented as a sequence of tokens similar to word sentences allowing us to apply a language model. Consequently, we propose using a deep generative encoder-decoder Transformer to learn the relationship between sequential trajectory points based on the self-attention mechanism. Our final solution does not require any manual feature extraction and can be easily adapted to other types of trajectories (e.g., car, people, and vessels). We have performed an extensive experimental evaluation that shows: (1) our approach is effective for both trajectory and sub-trajectory anomaly detection; and (2) it outperforms the baselines in some scenarios and statistically achieves comparable results in the others.