# Detecting Out-of-Distribution Samples in Complex IoT Traffic Based on Distance Loss
## 4 Experiments
### Robustness and Fairness Evaluation  
To ensure the reliability of the reported improvements, we adopted a rigorous and fair experimental design. All baseline and proposed methods were trained and tested using the same data partitions, backbone architectures, and optimization settings to eliminate experimental bias. To assess the robustness of our method, we introduced additive Gaussian noise \(\mathcal{N}(0,0.01^{2})\) to 20% of the test samples during evaluation. This simulates real-world perturbations such as sensor or network noise in IoT applications. As shown in Table 8, our method maintains consistently high performance, with a marginal decrease in AUROC (from 0.9905 to 0.9312) and FPR95 (from 0.0305 to 0.1513) on the CIC IoT 2022 dataset. This indicates that the learned representations and thresholding mechanism are robust to moderate perturbations in the input. \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multicolumn{2}{c}{**TTU**} & \multicolumn{2}{c}{**LMT**} & \multicolumn{2}{c}{**LVMR**} \\ \cline{2-7}  & **AUROC\(\uparrow\)** & **FPR95\(\downarrow\)** & **AUROC\(\uparrow\)** & **FPR95\(\downarrow\)** & **AUROC\(\uparrow\)** & **FPR95\(\downarrow\)** \\ \hline MSP & 0.7415 & 0.7942 & 0.7790 & 0.7654 & 0.7447 & 0.8177 \\ AE & 0.5173 & 0.8991 & 0.5657 & 0.9705 & 0.4250 & 0.9577 \\ ODIN & 0.7922 & 0.6418 & 0.8187 & 0.6111 & 0.7876 & 0.6460 \\ Energy & 0.7650 & 0.6784 & 0.7348 & 0.6755 & 0.7280 & 0.7222 \\ mahalanobis & 0.1733 & 0.9726 & 0.1290 & 0.9896 & 0.1775 & 0.9628 \\
**Ours** & \(\mathbf{0.8976\pm 0.0730}\) & \(\mathbf{0.3104\pm 0.0828}\) & \(\mathbf{0.9629\pm 0.0126}\) & \(\mathbf{0.1097\pm 0.0702}\) & \(\mathbf{0.8800\pm 0.0120}\) & \(\mathbf{0.2421\pm 0.0599}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of OOD detection performance between our method and baseline methods using the open-source IoT Sentinel dataset as ID samples and the real power grid traffic dataset as OOD samples. All results represent the average over 10 independent runs under identical conditions. For our method, we additionally report the standard deviation to assess performance stability. \(\uparrow\) indicates that higher values are better, and \(\downarrow\) indicates that lower values are better. The best-performing method is highlighted in bold. Interestingly, we observed that the performance of several baseline methods (e.g., MSP and ODIN) improved under noisy test conditions. A possible explanation is that Gaussian noise reduces the overconfidence of ID predictions, effectively increasing the separation between ID and OOD score distributions. In contrast, our method already \begin{table}
\begin{tabular}{l c c} \hline \hline
**Method** & **TTU** & **LMT** & **LVMR** \\ \hline Prec & 0.873178 & 0.9689 & 0.932345 \\ IQR & 0.850899 & 0.941543 & 0.864865 \\ Ksigma & 0.636895 & 0.871205 & 0.649914 \\ OTSU & 0.881939 & 0.44696 & 0.9344 \\ ECDF & 0.705876 & 0.381533 & 0.47022 \\ Inflection\_Std & 0.714447 & 0.961106 & 0.867697 \\ POT & 0.828682 & 0.576437 & 0.705651 \\ Ours & \(0.870305\pm 0.0156\) & \(0.977578\pm 0.0220\) & \(0.944754\pm 0.0331\) \\ \hline \hline \end{tabular}
\end{table} 
Table 6: F1 scores for OOD detection using different threshold selection strategies, with Amcrest as the OOD sample and the remaining devices as ID samples on the CIC IoT Dataset 2022. For our method, the result is reported as the average \(\pm\) standard deviation over five independent runs to assess robustness. \begin{table}
\begin{tabular}{l c c} \hline \hline
**Method** & **CIC IoT 2022** & **IoT Sentinel** \\ \hline MSP & 3.3157 & 0.7098 \\ AE & 2.0252 & 0.6448 \\ ODIN & 0.7935 & 0.2821 \\ Energy & 0.9031 & 0.1961 \\ Mahalanobis & 2.9780 & 1.3786 \\ Ours & 0.04324 & 0.0111 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Comparison of inference times (in seconds) for various OOD detection methods on the CIC IoT 2022 and IoT Sentinel datasets. Lower values represent better runtime performance.