# A Comparative Analysis of Anomaly Detection Methods in IoT Networks: An Experimental Study
###### Abstract  
The growth of the Internet of Things (IoT) and its integration with Industry 4.0 and 5.0 are generating new security challenges. One of the key elements of IoT systems is effective anomaly detection, which identifies abnormal behavior in devices or entire systems. This paper presents a comprehensive overview of existing methods for anomaly detection in IoT networks using machine learning (ML). A detailed analysis of various ML algorithms, both supervised (e.g., Random Forest, Gradient Boosting, SVM) and unsupervised (e.g., Isolation Forest, Autoencoder), was conducted. The results of tests conducted on popular datasets (IoT-23 and CICIoT-2023) were collected and analyzed in detail. The performance of the selected algorithms was evaluated using commonly used metrics (Accuracy, Precision, Recall, F1-score). The experimental results showed that the Random Forest and Autoencoder methods are highly effective in detecting anomalies. The article highlights the importance of appropriate data preprocessing to improve detection accuracy. Furthermore, the limitations of a centralized machine learning approach in the context of distributed IoT networks are discussed. The article also presents potential directions for future research in the field of anomaly detection in the IoT. c 2024 14 11545 11.11.11.11.11.11.11.11.11.11.11.11.11.1.11.  
as rule-based systems, are simple and easy to interpret, but struggle to cope with the complexity and scale of modern IoT data. In contrast, ML techniques such as decision trees, neural networks, and Support Vector Machines offer greater accuracy and adaptability in detecting subtle and evolving anomalies. Hybrid methods that combine rule-based systems with ML strike a balance between interpretability and efficiency. Unsupervised learning models are particularly useful when tagged data are sparse, but their effectiveness depends heavily on the quality of data preprocessing. Ensemble methods, which combine the results of multiple models, generally improve detection performance by reducing the occurrence of false alarms. Deep learning methods, while efficient, require large datasets and can be computationally expensive, making them less suitable for IoT devices with limited resources. Explainable artificial intelligence (XAI) is becoming increasingly important in anomaly detection to provide transparency and confidence in decisions made by complex models. Real-time detection is crucial for IoT networks, and methods supporting low-latency processing are favored in dynamic environments. Overall, our benchmarking study highlighted the trade-offs between accuracy, interpretability, computational efficiency, and scalability when choosing the right anomaly detection technique for IoT networks. Traditional security mechanisms, which rely on predefined signatures or static rules, are proving increasingly inadequate in the ever-changing landscape of the IoT [7]. IoT environments are dynamic, with devices constantly interacting, evolving, and generating vast quantities of data, making static security measures inadequate. Anomaly detection, which identifies deviations from the normal behavior of a device or system, is becoming a critical component of modern security strategies. By monitoring patterns and identifying anomalies, anomaly detection can help detect potential threats before they cause damage. Early anomaly detection enables rapid action to prevent data breaches and reduce the likelihood of service disruption. This proactive approach also helps identify and mitigate unauthorized access attempts, strengthening network security. In addition, anomaly detection can adapt to new threats that traditional methods may overlook, providing comprehensive protection. The real-time nature of IoT systems requires security mechanisms that are both flexible and responsive to emerging threats. Implementing robust anomaly detection increases overall system resilience, maintaining both network integrity and operational stability.