A Machine Learning Framework for detecting anomalies in IoT Systems for Smart City Architecture using Autoencoder
Abstract
The rapid expansion of Internet of Things (IoT) devices within smart city infrastructures has created significant challenges in protecting complex and diverse networks from cyberattacks and system anomalies. Conventional detection methods, often rule-based, lack the flexibility to handle the evolving, large-scale nature of IoT data. This study introduces a machine learning-based framework utilizing unsupervised deep learning—specifically, autoencoders for detecting anomalies in smart city IoT environments. The framework is tested on the TON_IoT dataset, which mirrors real-world network traffic and telemetry data from smart ecosystems. By training the autoencoder solely on benign data, the model learns efficient internal representations of normal activity. Deviations from this learned behaviour, identified through high reconstruction errors, signal potential anomalies. Experimental findings reveal that the model achieves strong performance in identifying both cyber threats and operational irregularities, with high precision, recall, F1 Score and overall accuracy. This work underscores the practical benefits of autoencoder-driven detection mechanisms and provides actionable guidance on feature reduction, threshold selection, and deployment scalability for securing IoT-based smart city systems.











