# An Analysis of ML-Based Outlier Detection from Mobile Phone Trajectories
## 5 Performance Analysis and Evaluation
### Outlier Detection with DBSCAN  
In the context of this work, DBSCAN is applied to different individual trajectories. This is not a trivial task, as the two parameters eps and MinPts require calibration for each individual trajectory. On our proposed framework for continuous detection of Pols, this implies that the inference engine will have to use a large range of MinPts and eps, as exemplified in Table 1, that is, with the DBSCAN algorithm, a range of eps parameter values has been tested, and for each, a range of MinPts values has also been tested. For instance, assuming an EPS of 7, then a MinPts value of 2 or of 3 has the same result, it assists in detecting 35 outliers. An eps of 8 and a MinPts of 6 or 7 results in 39 outliers detected. Varying the MinPts from 8 to 9, while keeping eps at 8, provides changes in the detected outliers. From this simple exercise, the aim is to highlight that there is not a clear selection of the eps and MinPts that results in a better selection of outliers. The values presented in Table 1 represent only a manual selection of the wide range of values tested. To find a way to circumvent this issue, the first approach considered was to use a wide range of values for the radius of the neighbourhood and the number of points to be checked around the core of a cluster. This idea seemed to overcome the problem of having to select different parameters for each trajectory. However, as explained in the previous paragraph, this approach became difficult due to the variability of the results in relation to the parameters used. Due to these results, we abandoned the previous method and redirected our approach to the methodology proposed by [PERSON] et al. [38] and revisited by [PERSON] et al. [39]. For each trajectory the following parameters have been selected:  
* MinPts = 2
* DIM, where DIM corresponds to the dataset dimension, i.e., the number of features provided in the dataset. If the dimension is high (more than 5 or 6 features), then MinPts = DIM + 1. * Using nearest neighbours, the average Euclidean distance between points is calculated. * After sorting these points, the obtained curve is the basis to fix the eps within the value of the inflection of the curve (knee), which normally occurs above the 95 th percentile. The result of applying this methodology is illustrated in Figure 3.  
This methodology requires human support in the sense that the adaptation requires an analysis of the visual result. This implies an excessive amount of work to be done on each trajectory, an aspect which is not compatible with a continuous detection engine. Our approach relies on the detection of the knee point, where this point is loosely defined as the point of maximum curvature in a system but also the optimal value in regards to an eps value. This approach is followed, e.g., in Kaggle [[https://www.kaggle.com/kevinarai/knee-elbow-point-detection](https://www.kaggle.com/kevinarai/knee-elbow-point-detection)]([https://www.kaggle.com/kevinarai/knee-elbow-point-detection](https://www.kaggle.com/kevinarai/knee-elbow-point-detection)), accessed on 12 August 2022) and better suited for a continuous engine that has to handle multiple trajectories (multiple dataflows). With the eps value optimised for a chosen MinPts, we provide the calculation with DBSCAN which led us to detect the outliers for each trajectory. A visual representation of \begin{table}
\begin{tabular}{c c c} \hline \hline
**Values EPS** & **Min Samples** & **Outliers Detected** \\ \hline
7 & 2 & 35 \\ \hline
7 & 3 & 35 \\ \hline
7 & 4 & 42 \\ \hline
7 & 5 & 42 \\ \hline
7 & 7 & 44 \\ \hline
7 & 8 & 47 \\ \hline
7 & 9 & 60 \\ \hline
8 & 2 & 31 \\ \hline
8 & 3 & 33 \\ \hline
8 & 4 & 35 \\ \hline
8 & 5 & 38 \\ \hline
8 & 6 & 39 \\ \hline
8 & 7 & 39 \\ \hline
8 & 8 & 40 \\ \hline
8 & 9 & 42 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: DBSCAN parameters variation and outlier detection impact. Figure 3: DBSCAN knee visualisation example. the detected outliers is illustrated in Figure 4 for the two datasets GEO (Geolife) and PTM (Portimao).