# Univariate Outlier Detection: Precision-Driven Algorithm for Single-Cluster Scenarios
## 4 Results And Discussion
### Comparison of Outlier Detection Algorithms
#### 4.4.2 Comparison Metrics and Calculations  
The following metrics are used to compare the performance of the outlier detection algorithms:  
The harmonic mean between precision and recall, combining both measures into a single metric. A higher F1 score indicates a better balance between correctly identifying outliers and minimizing false positives. \[\text{F1 Score}=2\cdot\frac{\text{Precision}\cdot\text{Recall}}{\text{ Precision}+\text{Recall}} \tag{4}\]  
Recall  
The proportion of actual outliers correctly identified by the algorithm. \[\text{Recall}=\frac{\text{True Positives}}{\text{True Positives}+\text{ False Negatives}} \tag{5}\]  
Accuracy  
The overall proportion of correct predictions (outliers and normal data points) made by the algorithm. \[\text{Accuracy}=\frac{\text{True Positives}+\text{True Negatives}}{\text{ Total Samples}} \tag{6}\]  
Precision  
The proportion of predicted outliers that are actually outliers. \[\text{Precision}=\frac{\text{True Positives}}{\text{True Positives}+\text{ False Positives}} \tag{7}\]In addition to the previously mentioned metrics, we visualized the trade-off between correctly identifying outliers (True Positive Rate) and misclassifying normal data (False Positive Rate) using ROC curves for each algorithm. ROC curves provide a valuable comparison tool with algorithms closer to the top-left corner indicating superior performance. Our proposed algorithm demonstrates significant advantages over one-class SVM and autoencoder algorithms in detecting outliers particularly those closer to the normal data. This advantage stems from the non-linear hyperbolic transformation, which effectively amplifies the separation between the main data and outliers, leading to improved detection accuracy. The one-class SVM exhibits strong performance, which is particularly evident in its high recall and accuracy scores. However, its precision and F1-score, while respectable, are surpassed by the proposed algorithm. The autoencoder, though offering a competitive alternative, falls short in terms of precision and F1-score compared to both the SVM and the proposed algorithm (Table 1). The proposed algorithm stands out with its remarkable F1-score of 97.78%, perfect recall of 100.00%, and near-perfect precision of 95.65% (Table 1). Such results signify its exceptional ability to accurately detect anomalies while minimizing false positives, which is a critical aspect in anomaly detection systems. The AUC score of 100% further solidifies its efficacy in distinguishing between normal and outlier instances compared to the SVM AUC score of 98% and the autoencoder AUC score of 89% (see Figures 8-10). While the proposed algorithm demonstrates strong performance in this specific context, its generalizability to diverse datasets can require further exploration. The non-linear hyperbolic transformation, although effective in separating outliers, can obscure their original distance from the reference point. This can be critical in certain scenarios where outliers farther from the reference point are more important than closer outliers. In such cases, the hyperbolic transformation might transform both types of outliers into a similar \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Algorithm** & **F1 Score** & **Recall** & **Accuracy** & **Precision** \\ \hline One-Class SVM & 79.25\% & 95.45\% & 88.78\% & 67.74\% \\ Autoencoder & 73.08\% & 86.36\% & 85.71\% & 63.33\% \\ Proposed & 97.78\% & 100.00\% & 98.98\% & 95.65\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of outlier detection algorithms. Figure 8: The ROC curve of the autoencoder. range, making it difficult to distinguish between them. However, it is important to note that for cases where precise deviation from the reference point is highly important, the proposed algorithm can still perform well. The one-class SVM and autoencoder, with further optimization and adaptability, might yield superior performance in different scenarios or data structures.