# Machine Learning for Blockchain and IoT Systems in Smart Cities: A Survey
## 2 Machine Learning in IoT Systems for Smart Cities  
In the context of smart cities, the integration of ML into IoT systems transcends conventional data processing and analytics, offering sophisticated mechanisms for real-time decision-making, anomaly detection, and system optimization. The complexity and scale of urban IoT networks necessitate the deployment of advanced ML models that can operate efficiently under constraints such as limited computational power, varying network conditions, and the need for real-time responsiveness [7; 8; 9; 10]. Figure 1: Overview of the survey focus areas. Deep learning (DL) models, particularly convolutional neural networks (CNNs) and recurrent neural networks (RNNs), are pivotal in extracting high-level features from vast, heterogeneous IoT data streams. For instance, CNNs are instrumental in processing visual data from city-wide surveillance systems, enabling real-time recognition of patterns related to traffic density, pedestrian movement, and even criminal activity [11; 12; 13; 14]. RNNs, with their ability to handle sequential data, excel in predictive maintenance scenarios, where they can analyze time-series data from sensors to forecast equipment failures with high accuracy [15; 16; 17; 18]. Moreover, the advent of federated learning (FL) has addressed the challenges of data privacy and decentralized data processing in smart cities. FL allows ML models to be trained across multiple edge devices--such as sensors, cameras, and actuators--without the need to centralize data. This approach not only mitigates privacy concerns by ensuring that sensitive data remain on the device but also reduces the latency and bandwidth requirements associated with transmitting data to a central server for processing. In smart cities, FL facilitates the creation of robust, localized models that are capable of adapting to the specific conditions of different urban areas, thereby enhancing the overall efficiency and responsiveness of IoT systems [19; 20; 21; 22]. In addition to predictive analytics, reinforcement learning (RL) has emerged as a powerful tool for dynamic optimization in smart city IoT systems. RL algorithms enable IoT devices to learn optimal strategies through trial and error, continuously improving their performance in dynamic environments. For example, in smart traffic management, RL-based systems can dynamically adjust traffic signal timings in response to real-time traffic conditions, leading to significant reductions in congestion and travel time. Similarly, in smart energy grids, RL can optimize the distribution of energy in real time, balancing supply and demand while minimizing energy loss and maximizing the use of renewable sources [23; 24; 25; 26; 27]. Another critical aspect of ML in IoT for smart cities is anomaly detection. As urban IoT systems are inherently complex and operate in unpredictable environments, the ability to detect anomalies--such as unusual traffic patterns, abnormal energy consumption, or unauthorized access to sensitive areas--is crucial for maintaining the security and efficiency of the city. Advanced ML techniques, including unsupervised learning and deep anomaly detection methods, are particularly effective in identifying these anomalies. These techniques can autonomously learn the normal operating patterns of various systems and flag deviations that may indicate potential issues or security threats. For instance, autoencoders--a type of neural network--can be employed to compress and reconstruct data, with significant reconstruction errors signaling potential anomalies that require further investigation [28; 29; 30; 31; 32]. What is more, integrating transfer learning into IoT systems enables the adaptation of pre-trained ML models to new urban environments with minimal additional data. This capability is especially valuable in smart cities, where the conditions and requirements can vary significantly across different regions.